Comments (10)
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.
from vulture.
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.
@jendrikseipp sounds great I am applying to work on this project in coala organization for GSOC 17 can you please guide me
from vulture.
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.
@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.
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.
@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.
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.
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)
- Mark deleted variables as used HOT 3
- passing filenames to pre-commit hook HOT 2
- AttributeError when parsing a decorator HOT 5
- Whitelist parameter of specific function HOT 2
- Pydantic false positive HOT 1
- Read config from `setup.cfg` HOT 1
- Feature request: not throw "unused variable" for __exit__ HOT 1
- [feat] Support setup.cfg configuration file HOT 2
- [feat] Support premade-whitelist HOT 1
- Listing uncalled functions across multiple projects/repositories. HOT 1
- Allow unreachable trailing `yield`, to make an abstract generator method HOT 5
- UnicodeEncodeError in core.py HOT 3
- Ignore subclasses HOT 1
- Add argument to filter for unused function, variable or class HOT 4
- False positive when enum is used in iteration HOT 7
- False positives on enum `_name_` and `_value_` attributes HOT 2
- False negatives when function/method/attribute name is in one of the whitelists/*_whitelist.py files. HOT 1
- Dedicated exit code for "Dead code found" HOT 2
- Wrong processing of typing.Protocol HOT 9
- Python 3.12: DeprecationWarning: ast.Str is deprecated and will be removed in Python 3.14; use ast.Constant instead HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vulture.