diff --git a/.github/workflows/lint-server.yml b/.github/workflows/lint-server.yml index 53593f870..02ec7a412 100644 --- a/.github/workflows/lint-server.yml +++ b/.github/workflows/lint-server.yml @@ -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 diff --git a/server/planning/commands/delete_marked_assignments_test.py b/server/planning/commands/delete_marked_assignments_test.py index 6923d9b27..9a5b3b527 100644 --- a/server/planning/commands/delete_marked_assignments_test.py +++ b/server/planning/commands/delete_marked_assignments_test.py @@ -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: diff --git a/server/planning/data_updates/00027_20210128-111254_events_planning_filters.py b/server/planning/data_updates/00027_20210128-111254_events_planning_filters.py index 4a3393405..b7cdee408 100644 --- a/server/planning/data_updates/00027_20210128-111254_events_planning_filters.py +++ b/server/planning/data_updates/00027_20210128-111254_events_planning_filters.py @@ -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): diff --git a/server/planning/data_updates/00029_20210215-155415_roles.py b/server/planning/data_updates/00029_20210215-155415_roles.py index 3713f022e..6da30a0d2 100644 --- a/server/planning/data_updates/00029_20210215-155415_roles.py +++ b/server/planning/data_updates/00029_20210215-155415_roles.py @@ -11,7 +11,6 @@ class DataUpdate(BaseDataUpdate): - resource = "roles" def forwards(self, mongodb_collection, mongodb_database): diff --git a/server/planning/data_updates/00030_20210316-105026_locations.py b/server/planning/data_updates/00030_20210316-105026_locations.py index 33ee7182f..6f8840ad1 100644 --- a/server/planning/data_updates/00030_20210316-105026_locations.py +++ b/server/planning/data_updates/00030_20210316-105026_locations.py @@ -14,7 +14,6 @@ class DataUpdate(BaseDataUpdate): - resource = "locations" def forwards(self, mongodb_collection, mongodb_database): diff --git a/server/planning/data_updates/00033_20210729-145921_planning_types.py b/server/planning/data_updates/00033_20210729-145921_planning_types.py index aedc295b5..1f8f08d29 100644 --- a/server/planning/data_updates/00033_20210729-145921_planning_types.py +++ b/server/planning/data_updates/00033_20210729-145921_planning_types.py @@ -23,7 +23,6 @@ class DataUpdate(BaseDataUpdate): - resource = "planning_types" resource_types = ["event", "planning", "coverage"] diff --git a/server/planning/events/events.py b/server/planning/events/events.py index 78d07cac4..e74f931b3 100644 --- a/server/planning/events/events.py +++ b/server/planning/events/events.py @@ -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) diff --git a/server/planning/feed_parsers/event_json_tests.py b/server/planning/feed_parsers/event_json_tests.py index 42065e0c8..6a3f67ef8 100644 --- a/server/planning/feed_parsers/event_json_tests.py +++ b/server/planning/feed_parsers/event_json_tests.py @@ -5,7 +5,6 @@ class EventJsonFeedParserTestCase(TestCase): - sample_json = {} def setUp(self): @@ -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", @@ -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", [ @@ -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": diff --git a/server/planning/feed_parsers/ics_2_0.py b/server/planning/feed_parsers/ics_2_0.py index ad5650cde..da2bcca0f 100644 --- a/server/planning/feed_parsers/ics_2_0.py +++ b/server/planning/feed_parsers/ics_2_0.py @@ -68,7 +68,6 @@ def parse_http(self, content, provider): return self.parse(cal, provider) def parse(self, cal, provider=None): - try: items = [] diff --git a/server/planning/feeding_services/event_file_service_tests.py b/server/planning/feeding_services/event_file_service_tests.py index b0688372e..3afdb0d1e 100644 --- a/server/planning/feeding_services/event_file_service_tests.py +++ b/server/planning/feeding_services/event_file_service_tests.py @@ -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"] diff --git a/server/planning/feeding_services/event_http_service_tests.py b/server/planning/feeding_services/event_http_service_tests.py index 8f744d024..c172c3257 100644 --- a/server/planning/feeding_services/event_http_service_tests.py +++ b/server/planning/feeding_services/event_http_service_tests.py @@ -8,7 +8,6 @@ def setUp(self): def test_update(self): with self.app.app_context(): - service = EventHTTPFeedingService() provider = { "_id": "ics_20", diff --git a/server/planning/planning_notifications_test.py b/server/planning/planning_notifications_test.py index 7cdd5f96e..b817efd92 100644 --- a/server/planning/planning_notifications_test.py +++ b/server/planning/planning_notifications_test.py @@ -14,7 +14,6 @@ class MockSlack: - api_call_OK = True def api_call(self, method, **pars): diff --git a/server/planning/search/eventsplanning_search.py b/server/planning/search/eventsplanning_search.py index 9ae7cb485..57b3e23fb 100644 --- a/server/planning/search/eventsplanning_search.py +++ b/server/planning/search/eventsplanning_search.py @@ -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": diff --git a/server/planning/search/planning_search.py b/server/planning/search/planning_search.py index 53e2b9ac3..300585ac1 100644 --- a/server/planning/search/planning_search.py +++ b/server/planning/search/planning_search.py @@ -24,7 +24,6 @@ class PlanningSearchService(superdesk.Service): - repos = ["events", "planning"] @property