Skip to content
This repository was archived by the owner on Sep 3, 2022. It is now read-only.

Commit b27dc58

Browse files
partheaYasser Elsayed
authored andcommitted
Fix all flake8 warnings. Enable all flake8 codes except E111, E114, E121 (#315)
* Remove unused variables. Fix all flake8 warnings with code prefix F. * Remove extra whitespaces. Fix all flake8 warnings with code prefix W. * Fix all flake8 warnings with prefix E4,E5,E7. * Fix all flake8 warnings with prefix E1,E2,E3. * Remove flake8 filter on Travis-CI * Fix all flake8 warnings on python 3.
1 parent 5deca12 commit b27dc58

File tree

153 files changed

+1776
-1687
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

153 files changed

+1776
-1687
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ before_install:
2222
- pip install flake8
2323

2424
before_script:
25-
- flake8 . --select=F401
25+
- flake8 .
2626

2727
script:
2828
- python ./tests/main.py

datalab/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,3 @@
99
# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
1010
# or implied. See the License for the specific language governing permissions and limitations under
1111
# the License.
12-

datalab/bigquery/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
'QueryResultsTable', 'QueryStats', 'Sampling', 'Schema', 'Table', 'TableMetadata',
3434
'UDF', 'TableName', 'DatasetName', 'View']
3535

36+
3637
def wait_any(jobs, timeout=None):
3738
""" Return when at least one of the specified jobs has completed or timeout expires.
3839

datalab/bigquery/_api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def datasets_update(self, dataset_name, dataset_info):
306306
"""
307307
url = Api._ENDPOINT + (Api._DATASETS_PATH % dataset_name)
308308
return datalab.utils.Http.request(url, method='PUT', data=dataset_info,
309-
credentials=self._credentials)
309+
credentials=self._credentials)
310310

311311
def datasets_get(self, dataset_name):
312312
"""Issues a request to retrieve information about a dataset.
@@ -433,8 +433,8 @@ def tabledata_insert_all(self, table_name, rows):
433433
url = Api._ENDPOINT + (Api._TABLES_PATH % table_name) + "/insertAll"
434434

435435
data = {
436-
'kind': 'bigquery#tableDataInsertAllRequest',
437-
'rows': rows
436+
'kind': 'bigquery#tableDataInsertAllRequest',
437+
'rows': rows
438438
}
439439

440440
return datalab.utils.Http.request(url, data=data, credentials=self._credentials)
@@ -498,8 +498,8 @@ def table_extract(self, table_name, destination, format='CSV', compress=True,
498498
if isinstance(destination, basestring):
499499
destination = [destination]
500500
data = {
501-
# 'projectId': table_name.project_id, # Code sample shows this but it is not in job
502-
# reference spec. Filed as b/19235843
501+
# 'projectId': table_name.project_id, # Code sample shows this but it is not in job
502+
# reference spec. Filed as b/19235843
503503
'kind': 'bigquery#job',
504504
'configuration': {
505505
'extract': {

datalab/bigquery/_federated_table.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,3 @@ def _to_query_json(self):
9595
if self._schema:
9696
json['schema'] = {'fields': self._schema._bq_schema}
9797
return json
98-

datalab/bigquery/_query.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -423,9 +423,10 @@ def execute_dry_run(self, dialect=None, billing_tier=None):
423423
An exception if the query was malformed.
424424
"""
425425
try:
426-
query_result = self._api.jobs_insert_query(self._sql, self._code, self._imports, dry_run=True,
427-
table_definitions=self._external_tables, dialect=dialect,
428-
billing_tier=billing_tier)
426+
query_result = self._api.jobs_insert_query(self._sql, self._code, self._imports,
427+
dry_run=True,
428+
table_definitions=self._external_tables,
429+
dialect=dialect, billing_tier=billing_tier)
429430
except Exception as e:
430431
raise e
431432
return query_result['statistics']['query']
@@ -540,4 +541,3 @@ def to_view(self, view_name):
540541
# Do the import here to avoid circular dependencies at top-level.
541542
from . import _view
542543
return _view.View(view_name, self._context).create(self._sql)
543-

datalab/bigquery/_query_job.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,3 @@ def results(self):
109109
if self.failed:
110110
raise Exception('Query failed: %s' % str(self.errors))
111111
return self._table
112-

datalab/bigquery/_schema.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def from_data(source):
264264
raise Exception(('Cannot create a schema from heterogeneous list %s; perhaps you meant ' +
265265
'to use Schema.from_record?') % str(source))
266266
elif isinstance(source[0], list) and \
267-
all([isinstance(l, list) and len(l) == len(source[0]) for l in source]):
267+
all([isinstance(l, list) and len(l) == len(source[0]) for l in source]):
268268
# A list of lists all of the same length; treat first entry as a list record.
269269
bq_schema = Schema._from_record(source[0])
270270
else:

datalab/bigquery/_table.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,4 +919,3 @@ def to_query(self, fields=None):
919919
elif isinstance(fields, list):
920920
fields = ','.join(fields)
921921
return _query.Query('SELECT %s FROM %s' % (fields, self._repr_sql_()), context=self._context)
922-

datalab/bigquery/_udf.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,7 @@ def _build_js(inputs, outputs, name, implementation, support_code):
7878
# Build the JS from the individual bits with proper escaping of the implementation
7979
if support_code is None:
8080
support_code = ''
81-
return ('{code}\n{name}={implementation};\n' +
82-
'bigquery.defineFunction(\'{name}\', {inputs}, {outputs}, {name});')\
83-
.format(code=support_code,
84-
name=name,
85-
implementation=implementation,
86-
inputs=str(input_fields),
87-
outputs=str(output_fields))
88-
81+
return ('{code}\n{name}={implementation};\nbigquery.defineFunction(\'{name}\', {inputs}, '
82+
'{outputs}, {name});').format(code=support_code, name=name,
83+
implementation=implementation, inputs=str(input_fields),
84+
outputs=str(output_fields))

0 commit comments

Comments
 (0)