Skip to content

Commit

Permalink
fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkLark86 committed Apr 5, 2023
1 parent 6bc379f commit 76a8ebb
Show file tree
Hide file tree
Showing 14 changed files with 13 additions and 23 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/lint-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,29 @@ jobs:
black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- run: pip install black
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install black~=23.0
- run: black --check server

flake8:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install flake8
- run: flake8 server

mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- run: pip install -Ur server/mypy-requirements.txt
- run: mypy server
1 change: 0 additions & 1 deletion server/planning/commands/delete_marked_assignments_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def setUp(self):
self.assignment_service = get_resource_service("assignments")

def assertAssignmentDeleted(self, assignment_ids, not_deleted=False):

for assignment_id in assignment_ids:
assignment = self.assignment_service.find_one(_id=assignment_id, req=None)
if not_deleted:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# This script converts `events_planning_filters` documents to newer schema
# Required after changes in PR: https://github.com/superdesk/superdesk-planning/pull/1511
class DataUpdate(BaseDataUpdate):

resource = "events_planning_filters"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class DataUpdate(BaseDataUpdate):

resource = "roles"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class DataUpdate(BaseDataUpdate):

resource = "locations"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class DataUpdate(BaseDataUpdate):

resource = "planning_types"
resource_types = ["event", "planning", "coverage"]

Expand Down
1 change: 0 additions & 1 deletion server/planning/events/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,6 @@ def on_created(self, docs):
event_id = str(doc.get(config.ID_FIELD))
# If we duplicated this event, update the history
if doc.get("duplicate_from"):

parent_id = doc["duplicate_from"]
parent_event = self.find_one(req=None, _id=parent_id)

Expand Down
4 changes: 0 additions & 4 deletions server/planning/feed_parsers/event_json_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class EventJsonFeedParserTestCase(TestCase):

sample_json = {}

def setUp(self):
Expand All @@ -18,7 +17,6 @@ def test_event_json_feed_parser_can_parse(self):

def test_event_json_feed_parser_parse(self):
with self.app.app_context():

random_event = {
"is_active": True,
"name": "random123",
Expand All @@ -33,7 +31,6 @@ def test_event_json_feed_parser_parse(self):

# add the random event items for above fields.
for field in assign_from_local_cv:

self.app.data.insert(
"vocabularies",
[
Expand All @@ -58,7 +55,6 @@ def test_event_json_feed_parser_parse(self):
# ignore fields like files as per the ACs in SDNTB-682
self.assertNotIn("files", events[0])
for field in assign_from_local_cv.keys():

# check if the same random is returned after parsing as inserted above.
if events[0].get(field):
if field == "occur_status":
Expand Down
1 change: 0 additions & 1 deletion server/planning/feed_parsers/ics_2_0.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ def parse_http(self, content, provider):
return self.parse(cal, provider)

def parse(self, cal, provider=None):

try:
items = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ def setUp(self):
@patch("planning.feeding_services.event_file_service.get_sorted_files")
def test_update(self, mock_os, mock_get_sorted_files):
with self.app.app_context():

service = EventFileFeedingService()
provider = {"feed_parser": "ics20", "config": {"path": "/test_file_drop"}}
mock_get_sorted_files.return_value = ["file1.txt", "file2.txt", "file3.txt"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def setUp(self):

def test_update(self):
with self.app.app_context():

service = EventHTTPFeedingService()
provider = {
"_id": "ics_20",
Expand Down
1 change: 0 additions & 1 deletion server/planning/planning_notifications_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class MockSlack:

api_call_OK = True

def api_call(self, method, **pars):
Expand Down
1 change: 0 additions & 1 deletion server/planning/search/eventsplanning_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ def _get_search_filter(self, repo: str, params: Dict[str, Any]):
def _construct_search_query(
self, repo: str, params: Dict[str, Any], search_filter: Optional[Dict[str, Any]]
) -> Dict[str, Any]:

if repo == "events":
filters = EVENT_SEARCH_FILTERS
elif repo == "planning":
Expand Down
1 change: 0 additions & 1 deletion server/planning/search/planning_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class PlanningSearchService(superdesk.Service):

repos = ["events", "planning"]

@property
Expand Down

0 comments on commit 76a8ebb

Please sign in to comment.