Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pylint-django work with master pylint/astroid #70

Merged
merged 4 commits into from
Mar 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pylint_django/augmentations/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ class ModelB(models.Model):
if (node_is_subclass(cls,
'django.db.models.manager.Manager',
'django.db.models.base.Model',
'.Model')):
'.Model',
'django.db.models.fields.related.ForeignObject')):
# This means that we are looking at a subclass of models.Model
# and something is trying to access a <something>_set attribute.
# Since this could exist, we will return so as not to raise an
Expand Down
2 changes: 1 addition & 1 deletion pylint_django/transforms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def set_fake_locals(module):
if module.name != package_name:
return
for class_name in class_names:
module._locals[class_name] = fake._locals[class_name] # pylint: disable=protected-access
module.locals[class_name] = fake.locals[class_name]

MANAGER.register_transform(nodes.Module, set_fake_locals)

Expand Down
34 changes: 33 additions & 1 deletion pylint_django/transforms/transforms/django_db_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,39 @@ class Model(object):
MultipleObjectsReturned = MultipleObjectsReturned
DoesNotExist = ObjectDoesNotExist

save = lambda *a, **kw: None
delete = lambda *a, **kw: None

# eliminate E1002 for Manager object
class Manager(object):
pass
get_queryset = lambda *a, **kw: None
none = lambda *a, **kw: None
all = lambda *a, **kw: None
count = lambda *a, **kw: None
dates = lambda *a, **kw: None
distinct = lambda *a, **kw: None
extra = lambda *a, **kw: None
get = lambda *a, **kw: None
get_or_create = lambda *a, **kw: None
create = lambda *a, **kw: None
bulk_create = lambda *a, **kw: None
filter = lambda *a, **kw: None
aggregate = lambda *a, **kw: None
annotate = lambda *a, **kw: None
complex_filter = lambda *a, **kw: None
exclude = lambda *a, **kw: None
in_bulk = lambda *a, **kw: None
iterator = lambda *a, **kw: None
latest = lambda *a, **kw: None
order_by = lambda *a, **kw: None
select_for_update = lambda *a, **kw: None
select_related = lambda *a, **kw: None
prefetch_related = lambda *a, **kw: None
values = lambda *a, **kw: None
values_list = lambda *a, **kw: None
update = lambda *a, **kw: None
reverse = lambda *a, **kw: None
defer = lambda *a, **kw: None
only = lambda *a, **kw: None
using = lambda *a, **kw: None
exists = lambda *a, **kw: None