Skip to content
This repository was archived by the owner on Feb 8, 2019. It is now read-only.

Update python files with some moderately aggressive linting.#54

Open
wtokumaru wants to merge 4 commits intochronoscio:masterfrom
wtokumaru:lint
Open

Update python files with some moderately aggressive linting.#54
wtokumaru wants to merge 4 commits intochronoscio:masterfrom
wtokumaru:lint

Conversation

@wtokumaru
Copy link
Copy Markdown

@wtokumaru wtokumaru commented Oct 14, 2018

Figured I might as well take care of the excessively long lines triggering lint errors. Not certain about what to put in some of the missing doctsrings so please let me know what they should say. (Bad doctsrings are often worse than none.) Still can not request reviews or add tags. Not certain about when to track migrations so I have a separate commit for the file that changed when I ran migrate.

Obviously we do not need all of this but I figure it might be worth discussion.

Comment thread project/api/filters.py Outdated
)

def filter_bounds(self, queryset, field_name, value):
"""Check the geometry."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter to geometries that intersect @bounds.

Comment thread project/api/filters.py Outdated
return queryset.filter(geo__intersects=geom)

def filter_date(self, queryset, field_name, value):
"""Check the time range."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Filter to territories that exist during @Date

Comment thread project/api/models.py Outdated
"""Manager for the Nation model to handle lookups by url_id."""

def get_by_natural_key(self, url_id):
"""Returns attributes by the given url_id."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

delete

Comment thread project/api/models.py Outdated
name = models.TextField(
max_length=100,
help_text="Canonical name, should not include any epithets, must be unique",
help_text="Canonical name, which should not include any epithets"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to conform so strictly to -l 80. We should leave this on one line imo. Also avoid extra migration.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The split is done elsewhere in the same file already, so it makes sense to me for it to be consistent.

Comment thread project/api/models.py
Comment thread project/api/models.py Outdated
super(DiplomaticRelation, self).clean(*args, **kwargs)

def save(self, *args, **kwargs):
"""Save the DiplomaticRelation data."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

Comment thread project/api/permissions.py
Comment thread project/api/permissions.py Outdated
0,
re.DOTALL)
cert = '-----BEGIN CERTIFICATE-----\n' + body + '\n-----END CERTIFICATE-----'
cert = ('-----BEGIN CERTIFICATE-----\n' + body +
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leave as is

Comment thread project/api/serializers.py Outdated
)

def to_internal_value(self, data):
"""Converts data to GeoJSON."""
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Describe what the function is actually doing to the data

Comment thread project/interactivemap/settings.py Outdated
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
'NAME': ('django.contrib.auth.password_validation.UserAttribute'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

really?

Comment thread project/api/models.py
history = HistoricalRecords()

def clean(self, *args, **kwargs):
def clean(self, *args, **kwargs): # noqa
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disable the rule thats necessitating these noqa?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants