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

@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.

)

def filter_bounds(self, queryset, field_name, value):
"""Check the geometry."""
Copy link
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.

return queryset.filter(geo__intersects=geom)

def filter_date(self, queryset, field_name, value):
"""Check the time range."""
Copy link
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

"""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
Contributor

Choose a reason for hiding this comment

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

delete

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
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
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.

super(DiplomaticRelation, self).clean(*args, **kwargs)

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

Choose a reason for hiding this comment

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

remove

0,
re.DOTALL)
cert = '-----BEGIN CERTIFICATE-----\n' + body + '\n-----END CERTIFICATE-----'
cert = ('-----BEGIN CERTIFICATE-----\n' + body +
Copy link
Contributor

Choose a reason for hiding this comment

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

leave as is

)

def to_internal_value(self, data):
"""Converts data to GeoJSON."""
Copy link
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

AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
'NAME': ('django.contrib.auth.password_validation.UserAttribute'
Copy link
Contributor

Choose a reason for hiding this comment

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

really?

history = HistoricalRecords()

def clean(self, *args, **kwargs):
def clean(self, *args, **kwargs): # noqa
Copy link
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