Skip to content

Commit 5d0fb5a

Browse files
committed
Build: add pre-commit for flake8
I add to disable some warning, a few of them should be enable later but they require a lot of change. Most of them are from star import... A few unused import are infact used, I will resolve this in another PR
1 parent 52b7550 commit 5d0fb5a

File tree

7 files changed

+27
-15
lines changed

7 files changed

+27
-15
lines changed

.flake8

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[flake8]
2+
max-line-length=113
3+
exclude=.git,__pycache__,source/third_party,debug,release,source/sql/,*_pb2.py,build
4+
select = C,F,B,B950
5+
ignore = F405,F401,F841,F811,F403
6+
#F405: name may be undefined, or defined from star imports: module
7+
#F401: imported but unused
8+
#F841: local variable is assigned to but never used
9+
#F811: redefinition of unused
10+
#F403: import * used; unable to detect undefined names

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: trailing-whitespace
1111
- id: check-ast
1212
- id: check-merge-conflict
13-
#- id: flake8
13+
- id: flake8
1414
- repo: https://github.com/CanalTP/navitia-pre-commit
1515
rev: master
1616
hooks:

source/jormungandr/jormungandr/interfaces/v1/serializer/time.py

-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ class DateTimeDictField(Field, DateTimeType):
6868

6969
def to_value(self, value):
7070
return timestamp_to_str(value) if value else None
71-
super(DateTimeDictField, self).__init__(schema_type=str, schema_metadata=schema_metadata, **kwargs)
7271

7372

7473
class PeriodSerializer(PbNestedSerializer):

source/jormungandr/jormungandr/resources_utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
from jormungandr.interfaces.argument import ArgumentDoc
4343
from jormungandr.interfaces.v1.serializer.jsonschema.serializer import SwaggerOptionPathSerializer
4444
from jormungandr.interfaces.v1.swagger_schema import make_schema
45+
from datetime import datetime
4546
from navitiacommon.parser_args_type import BooleanType
4647

4748

source/jormungandr/requirements_dev.txt

+1
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ jsonschema==2.6.0
1111
pytest-timeout==1.3.3
1212
mypy==0.670; python_version > '3.0'
1313
mypy-extensions==0.4.1; python_version > '3.0'
14+
flake8==3.5.0

source/navitiacommon/navitiacommon/utils.py

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import zipfile
3131
import os
3232
import glob
33+
import logging
3334

3435
street_source_types = ['OSM']
3536
address_source_types = ['BANO', 'OSM']

source/sql/alembic/versions/1651f9b235f5_journey_pattern_suppression.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,12 @@ def downgrade():
5757
op.drop_column('stop_time', 'order', schema='navitia')
5858
op.create_table(
5959
'journey_pattern',
60-
sa.Column('id', BIGINT(), primary_key=True, nullable=False),
61-
sa.Column('route_id', BIGINT(), primary_key=False, nullable=False),
62-
sa.Column('physical_mode_id', BIGINT(), primary_key=False, nullable=False),
63-
sa.Column('uri', TEXT(), primary_key=False, nullable=False),
64-
sa.Column('name', TEXT(), primary_key=False, nullable=False),
65-
sa.Column('is_frequence', BOOLEAN(), primary_key=False, nullable=False),
60+
sa.Column('id', sa.BIGINT(), primary_key=True, nullable=False),
61+
sa.Column('route_id', sa.BIGINT(), primary_key=False, nullable=False),
62+
sa.Column('physical_mode_id', sa.BIGINT(), primary_key=False, nullable=False),
63+
sa.Column('uri', sa.TEXT(), primary_key=False, nullable=False),
64+
sa.Column('name', sa.TEXT(), primary_key=False, nullable=False),
65+
sa.Column('is_frequence', sa.BOOLEAN(), primary_key=False, nullable=False),
6666
sa.ForeignKeyConstraint(['route_id'], [u'navitia.route.id'], name=u'journey_pattern_route_id_fkey'),
6767
sa.ForeignKeyConstraint(
6868
['physical_mode_id'], [u'navitia.physical_mode.id'], name=u'journey_pattern_physical_mode_id_fkey'
@@ -71,15 +71,15 @@ def downgrade():
7171
)
7272
op.create_table(
7373
'journey_pattern_point',
74-
sa.Column('id', BIGINT(), primary_key=True, nullable=False),
75-
sa.Column('journey_pattern_id', BIGINT(), primary_key=False, nullable=False),
76-
sa.Column('name', TEXT(), primary_key=False, nullable=False),
77-
sa.Column('uri', TEXT(), primary_key=False, nullable=False),
78-
sa.Column('order', INTEGER(), primary_key=False, nullable=False),
79-
sa.Column('stop_point_id', BIGINT(), primary_key=False, nullable=False),
74+
sa.Column('id', sa.BIGINT(), primary_key=True, nullable=False),
75+
sa.Column('journey_pattern_id', sa.BIGINT(), primary_key=False, nullable=False),
76+
sa.Column('name', sa.TEXT(), primary_key=False, nullable=False),
77+
sa.Column('uri', sa.TEXT(), primary_key=False, nullable=False),
78+
sa.Column('order', sa.INTEGER(), primary_key=False, nullable=False),
79+
sa.Column('stop_point_id', sa.BIGINT(), primary_key=False, nullable=False),
8080
sa.Column(
8181
'shape_from_prev',
82-
Geography(geometry_type='LINESTRING', srid=4326, spatial_index=False),
82+
ga.Geography(geometry_type='LINESTRING', srid=4326, spatial_index=False),
8383
primary_key=False,
8484
),
8585
sa.ForeignKeyConstraint(

0 commit comments

Comments
 (0)