Code Monkey home page Code Monkey logo

Comments (10)

jendrikseipp avatar jendrikseipp commented on June 29, 2024 3

It would be easier to comment on a pull request.

  • async def was introduced in Python 3.5, not 3.0.
  • Obviously, the test should use async def.

from vulture.

jendrikseipp avatar jendrikseipp commented on June 29, 2024 1

from vulture.

jendrikseipp avatar jendrikseipp commented on June 29, 2024

Original comment by Jendrik Seipp (Bitbucket: jendrikseipp, GitHub: jendrikseipp):


Would you care to make a pull request? If so, please include a test for this new feature.

from vulture.

jack17529 avatar jack17529 commented on June 29, 2024

@jendrikseipp sounds great I am applying to work on this project in coala organization for GSOC 17 can you please guide me

from vulture.

jendrikseipp avatar jendrikseipp commented on June 29, 2024

Sounds good! For this issue, you'll have to point from visit_AsyncFunctionDef to visit_FunctionDef and add a test case to test_scavenging.py that tests the new language constructs. You'll have to make sure that the test only gets executed under the Python versions that support the language feature.

from vulture.

jack17529 avatar jack17529 commented on June 29, 2024

@jendrikseipp Sir can you please join https://gitter.im/coala/coala/gsoc and other gitter rooms or if you don't like please send me your email id , either way you want to communicate as I am currently reading the code of vulture repo.

from vulture.

jack17529 avatar jack17529 commented on June 29, 2024

import sys
if (sys.version_info > (3, 0)):
# Python 3 code in this block
import base64
return base64.b64encode(data).decode()
else:
# Python 2 code in this block
return data.encode("base64")

as according to Python documentation we can use sys.version_info:
A tuple containing the five components of the version number: major, minor, micro, releaselevel, and serial. All values except releaselevel are integers; the release level is 'alpha', 'beta', 'candidate', or 'final'. The version_info value corresponding to the Python version 2.0 is (2, 0, 0, 'final', 0). The components can also be accessed by name, so sys.version_info[0] is equivalent to sys.version_info.major and so on.

from vulture.

jack17529 avatar jack17529 commented on June 29, 2024

@jendrikseipp
Should I use this in def visit_FunctionDef(self, node) to make it sync with test_scavenging.py
Or should I make a new function that first checks the version and then only executes vulture.py

from vulture.

jendrikseipp avatar jendrikseipp commented on June 29, 2024

In vulture.py we shouldn't need to add an additional test for Python 3 since visit_AsyncFunctionDef will only be called in Python versions that support it. However, you need to skip the test that tests the new feature on older interpreters with the skipif py.test feature: https://docs.pytest.org/en/latest/skipping.html#id1.

from vulture.

jack17529 avatar jack17529 commented on June 29, 2024

import sys
@pytest.mark.skipif(sys.version_info < (3,0),
reason="requires python3.0")
def test_function4(v):
v.scan("""
class Bar(object):
def foo(self):
pass

b = Bar()
b.foo
""")
assert v.used_attrs == ['foo']
assert v.unused_funcs == []
assert v.defined_props == []
assert v.defined_funcs == ['Bar', 'foo']

Is this right please check.

from vulture.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.