Skip to content

Commit

Permalink
Merge pull request #21 from JustFixNYC/pyflakes
Browse files Browse the repository at this point in the history
Add pyflakes and fix its warnings
  • Loading branch information
toolness authored Feb 8, 2019
2 parents 0095e1f + 3296217 commit dce7ac8
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 15 deletions.
3 changes: 1 addition & 2 deletions aws_schedule_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
AWS_DEFAULT_REGION The AWS region to use.
"""

import sys
from typing import List, Dict
import json
import boto3
Expand Down Expand Up @@ -133,7 +132,7 @@ def create_task(

print(f"Creating rule '{name}' with schedule {schedule_expression}.")
client = boto3.client('events')
response = client.put_rule(
client.put_rule(
Name=name,
ScheduleExpression=schedule_expression,
State="ENABLED",
Expand Down
3 changes: 0 additions & 3 deletions lib/db_perms.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from typing import List


def exec_grant_sql(conn, sql: str):
if not sql:
return
Expand Down
2 changes: 1 addition & 1 deletion lib/lastmod.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Optional, NamedTuple, TypeVar, Type, Dict, List, Mapping
from typing import Optional, NamedTuple, Dict, List, Mapping
import requests

from .dbhash import AbstractDbHash
Expand Down
1 change: 0 additions & 1 deletion lib/parse_created_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from functools import lru_cache
import sqlparse
from sqlparse.sql import Identifier
from sqlparse import tokens as T
import nycdb


Expand Down
5 changes: 0 additions & 5 deletions load_dataset.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import os
import sys
import subprocess
import contextlib
import time
from pathlib import Path
from typing import NamedTuple, List
from types import SimpleNamespace
import urllib.parse
import psycopg2
import yaml
import nycdb.dataset
from nycdb.dataset import Dataset
from nycdb.utility import list_wrap
Expand Down Expand Up @@ -239,8 +236,6 @@ def main(argv: List[str]=sys.argv):

NYCDB_DATA_DIR.mkdir(parents=True, exist_ok=True)

tables = get_dataset_tables()

dataset = os.environ.get('DATASET', '')

if len(argv) > 1:
Expand Down
1 change: 1 addition & 0 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ boto3
docopt
python-dotenv
requests-mock
pyflakes==2.1.0
3 changes: 0 additions & 3 deletions tests/test_load_dataset.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import os
import time
import subprocess
from unittest.mock import patch
from typing import Dict
import urllib.parse
import pytest
import nycdb.dataset

Expand Down
15 changes: 15 additions & 0 deletions tests/test_pyflakes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from pathlib import Path
import subprocess
import glob


ROOT_DIR = Path(__file__).parent.parent.resolve()


def test_pyflakes_works():
subprocess.check_call([
'pyflakes',
*glob.glob(str(ROOT_DIR / '*.py')),
'lib',
'tests'
], cwd=ROOT_DIR)

0 comments on commit dce7ac8

Please sign in to comment.