Skip to content

Commit

Permalink
fix black
Browse files Browse the repository at this point in the history
  • Loading branch information
petrjasek committed Feb 1, 2023
1 parent 6c269b7 commit d8b0947
Show file tree
Hide file tree
Showing 106 changed files with 10 additions and 143 deletions.
1 change: 0 additions & 1 deletion apps/archive/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@


def init_app(app) -> None:

endpoint_name = "ingest"
service: Any = AppIngestService(endpoint_name, backend=superdesk.get_backend())
IngestResource(endpoint_name, app=app, service=service)
Expand Down
1 change: 0 additions & 1 deletion apps/archive/autocomplete.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class AutocompleteResource(superdesk.Resource):


class AutocompleteService(superdesk.Service):

field_mapping = {
"slugline": "slugline.keyword",
}
Expand Down
1 change: 0 additions & 1 deletion apps/archive/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def run(self):
logger.info("{} Starting to remove expired content.".format(self.log_msg))

try:

logger.info("{} Removing expired content for expiry.".format(self.log_msg))
# all functions should be called, even the first one throw exception,
# so they are wrapped with log_exeption
Expand Down
1 change: 0 additions & 1 deletion apps/archive_broadcast/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@


def init_app(app) -> None:

endpoint_name = ARCHIVE_BROADCAST_NAME
service = ArchiveBroadcastService(endpoint_name, backend=superdesk.get_backend())
ArchiveBroadcastResource(endpoint_name, app=app, service=service)
Expand Down
1 change: 0 additions & 1 deletion apps/archive_broadcast/broadcast.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ class ArchiveBroadcastResource(Resource):


class ArchiveBroadcastService(BaseService):

packageService = PackageService()

def create(self, docs):
Expand Down
1 change: 0 additions & 1 deletion apps/archived/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def init_app(app) -> None:

endpoint_name = "archived"
service = ArchivedService(endpoint_name, backend=superdesk.get_backend())
ArchivedResource(endpoint_name, app=app, service=service)
1 change: 0 additions & 1 deletion apps/auth/db/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class CreateUserCommand(superdesk.Command):
)

def run(self, username, password, email, admin=False, support=False):

# force type conversion to boolean
user_type = "administrator" if admin else "user"

Expand Down
1 change: 0 additions & 1 deletion apps/contacts/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

class ContactsService(Service):
def get(self, req, lookup):

# by default the response will have the inactive entries filtered out
if "all" not in req.args:
lookup["is_active"] = True
Expand Down
1 change: 0 additions & 1 deletion apps/content_filters/filter_condition/filter_condition.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ def contains_not(self):
return self.operator.contains_not()

def does_match(self, article):

if not self.field.is_in_article(article) and type(self.operator) is not ExistsOperator:
return (
type(self.operator) is NotInOperator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@


class FilterConditionValue:

mongo_mapper = {
FilterConditionOperatorsEnum.startswith: "^{}",
FilterConditionOperatorsEnum.like: ".*{}.*",
Expand Down
2 changes: 1 addition & 1 deletion apps/content_types/content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ def get_subject_name(fields_map):


def set_field_name(editor, field_names):
for (field, name) in field_names.items():
for field, name in field_names.items():
editor.setdefault(field, {})["field_name"] = name


Expand Down
1 change: 0 additions & 1 deletion apps/desks.py
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,6 @@ def get_by_user(self, user_id):


class SluglineDesksResource(Resource):

url = 'desks/<regex("[a-f0-9]{24}"):desk_id>/sluglines'
datasource = {
"source": "published",
Expand Down
2 changes: 0 additions & 2 deletions apps/ldap/ldap.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ def authenticate_and_fetch_profile(self, username, password, username_for_profil

class ADAuthService(AuthService):
def on_create(self, docs):

user_service = get_resource_service("users")
for doc in docs:
user = self.authenticate(doc)
Expand Down Expand Up @@ -196,7 +195,6 @@ class ImportUserProfileService(UsersService):
"""Service Class for endpoint /import_profile"""

def on_create(self, docs):

logged_in_user = get_user().get("username")
for index, doc in enumerate(docs):
# ensuring the that logged in user is importing the profile.
Expand Down
2 changes: 0 additions & 2 deletions apps/legal_archive/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ def upsert_into_legal_archive(self, item_id):
:param dict item_id: id of the document from 'archive' collection.
"""
try:

logger.info("Import item into legal {}.".format(item_id))

doc = get_resource_service(ARCHIVE).find_one(req=None, _id=item_id)
Expand Down Expand Up @@ -169,7 +168,6 @@ def upsert_into_legal_archive(self, item_id):
and article_in_legal_archive[config.VERSION] < legal_archive_doc[config.VERSION]
and len(versions_to_insert) == 0
):

resource_def = app.config["DOMAIN"][ARCHIVE]
versioned_doc = deepcopy(legal_archive_doc)
versioned_doc[versioned_id_field(resource_def)] = legal_archive_doc[config.ID_FIELD]
Expand Down
4 changes: 2 additions & 2 deletions apps/packages/package_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def on_create(self, docs):
package_create_signal.send(self, docs=docs)

def on_created(self, docs):
for (doc, assoc) in [(doc, assoc) for doc in docs for assoc in self._get_associations(doc)]:
for doc, assoc in [(doc, assoc) for doc in docs for assoc in self._get_associations(doc)]:
self.update_link(doc, assoc)

def on_update(self, updates, original):
Expand Down Expand Up @@ -181,7 +181,7 @@ def check_that_all_groups_are_referenced_in_root(self, root, groups):
raise SuperdeskApiError.forbiddenError(message=message)

def check_package_associations(self, docs):
for (doc, group) in ((doc, group) for doc in docs for group in doc.get(GROUPS, [])):
for doc, group in ((doc, group) for doc in docs for group in doc.get(GROUPS, [])):
associations = group.get(REFS, [])
self.check_for_duplicates(doc, associations)
for assoc in associations:
Expand Down
1 change: 0 additions & 1 deletion apps/picture_crop/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ def create(self, docs, **kwargs):


class PictureCropResource(superdesk.Resource):

item_methods = []
resource_methods = ["POST"]
privileges = {"POST": "archive"}
Expand Down
2 changes: 1 addition & 1 deletion apps/prepopulate/app_initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def run(self, entity_name=None, path=None, sample_data=False, force=False, init_
# put mapping to elastic
try:
app.data.init_elastic(app)
except (elasticsearch.exceptions.TransportError) as err:
except elasticsearch.exceptions.TransportError as err:
logger.error(err)

if app.config.get("REBUILD_ELASTIC_ON_INIT_DATA_ERROR"):
Expand Down
1 change: 0 additions & 1 deletion apps/publish/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@


def init_app(app) -> None:

endpoint_name = "archive_publish"
service: Any = ArchivePublishService(endpoint_name, backend=get_backend())
ArchivePublishResource(endpoint_name, app=app, service=service)
Expand Down
1 change: 0 additions & 1 deletion apps/publish/content/publish.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ def set_desk(self, updates, original):
and request.args
and request.args.get("desk_id")
):

desk_id = request.args["desk_id"]
updates["task"] = updates.get("task", original.get("task", {}))
updates["task"]["desk"] = desk_id
Expand Down
1 change: 0 additions & 1 deletion apps/publish/content/resend.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class ResendResource(ArchiveResource):


class ResendService(Service):

digital = partial(
filter, lambda s: (s.get("subscriber_type", "") in {SUBSCRIBER_TYPES.DIGITAL, SUBSCRIBER_TYPES.ALL})
)
Expand Down
1 change: 0 additions & 1 deletion apps/publish/content/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,6 @@ def test_reload_filters_if_updated(self):


class TimeoutTest(TestCase):

published_items = [
{
"_id": ObjectId("58006b8d1d41c88eace5179d"),
Expand Down
1 change: 0 additions & 1 deletion apps/publish/enqueue/enqueue_corrected.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@


class EnqueueCorrectedService(EnqueueService):

publish_type = "correct"
published_state = "corrected"

Expand Down
1 change: 0 additions & 1 deletion apps/publish/enqueue/enqueue_killed.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class EnqueueKilledService(EnqueueService):

publish_type = "kill"
published_state = "killed"

Expand Down
1 change: 0 additions & 1 deletion apps/publish/enqueue/enqueue_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ def queue_transmission(self, doc, subscribers, subscriber_codes=None, associatio
queued = False
no_formatters = []
for subscriber in subscribers:

try:
if (
doc[ITEM_TYPE] not in [CONTENT_TYPE.TEXT, CONTENT_TYPE.PREFORMATTED]
Expand Down
1 change: 0 additions & 1 deletion apps/spellcheck/spellcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ def suggest(word):


class SpellcheckResource(superdesk.Resource):

resource_methods = ["POST"]
item_methods = []

Expand Down
1 change: 0 additions & 1 deletion apps/workqueue/workqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ class WorkqueueResource(superdesk.Resource):


class WorkqueueService(superdesk.Service):

pass
1 change: 0 additions & 1 deletion apps/workspace/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class WorkspaceResource(superdesk.Resource):

schema = {
"name": {"type": "string", "unique_to_user": True},
"widgets": {"type": "list"},
Expand Down
1 change: 0 additions & 1 deletion content_api/search/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


class SearchResource(Resource):

item_url = 'regex("[\w,.:-]+")'
schema = schema

Expand Down
1 change: 0 additions & 1 deletion superdesk/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@


def init_app(app) -> None:

endpoint_name = "activity"
service = ActivityService(endpoint_name, backend=superdesk.get_backend())
ActivityResource(endpoint_name, app=app, service=service)
Expand Down
1 change: 0 additions & 1 deletion superdesk/auth_server/clients.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class AuthServerClientsResource(superdesk.Resource):

schema = {
"name": {
"type": "string",
Expand Down
1 change: 0 additions & 1 deletion superdesk/celery_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ def __get_redis(app_ctx):


def update_key(key, flag=False, db=None):

if db is None:
db = app.redis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class DataUpdate(BaseDataUpdate):

resource = "vocabularies"
product_types = {
"_id": "product_types",
Expand Down
1 change: 0 additions & 1 deletion superdesk/data_updates/00004_20170908-140205_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class DataUpdate(BaseDataUpdate):

resource = "users"

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 = "vocabularies"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
1 change: 0 additions & 1 deletion superdesk/data_updates/00005_20171110-170620_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class DataUpdate(BaseDataUpdate):

resource = "archive"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
2 changes: 0 additions & 2 deletions superdesk/data_updates/00007_20180321-092824_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,10 @@ def get_updated_editor_state(editor_state):


class DataUpdate(BaseDataUpdate):

resource = "archive" # will use multiple resources, keeping this here so validation passes

def forwards(self, mongodb_collection, mongodb_database):
for resource in ["archive", "archive_autosave", "published"]:

collection = mongodb_database[resource]

for item in collection.find({"editor_state": {"$exists": True}}):
Expand Down
3 changes: 0 additions & 3 deletions superdesk/data_updates/00008_20180404-165521_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@


class DataUpdate(BaseDataUpdate):

resource = "archive" # will use multiple resources, keeping this here so validation passes

def forwards(self, mongodb_collection, mongodb_database):
for resource in ["archive", "archive_autosave", "published"]:

collection = mongodb_database[resource]

for item in collection.find({"editor_state": {"$exists": True}}):
Expand All @@ -30,7 +28,6 @@ def forwards(self, mongodb_collection, mongodb_database):

def backwards(self, mongodb_collection, mongodb_database):
for resource in ["archive", "archive_autosave", "published"]:

collection = mongodb_database[resource]

for item in collection.find({"fields_meta": {"$exists": True}}):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@


class DataUpdate(BaseDataUpdate):

resource = "vocabularies"
update_fields = ["name", "qcode"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@


class DataUpdate(BaseDataUpdate):

resource = "vocabularies"

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 = "vocabularies"

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


class DataUpdate(BaseDataUpdate):

resource = "vocabularies"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
2 changes: 0 additions & 2 deletions superdesk/data_updates/00014_20181114-153727_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,9 @@ def __init__(self, id):


class DataUpdate(BaseDataUpdate):

resource = "archive"

def forwards(self, mongodb_collection, mongodb_database):

# building multiple trees
tree_items = {}
for item in mongodb_collection.find({"translated_from": {"$exists": True}}):
Expand Down
1 change: 0 additions & 1 deletion superdesk/data_updates/00015_20181127-105425_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ def __init__(self, id):


class DataUpdate(BaseDataUpdate):

resource = "archive" # will use multiple resources, keeping this here so validation passes

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
1 change: 0 additions & 1 deletion superdesk/data_updates/00016_20181227-160331_archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

# This script replaces the whole json of related item with respective _id only
class DataUpdate(BaseDataUpdate):

resource = "archive"

def forwards(self, mongodb_collection, mongodb_database):
Expand Down
Loading

0 comments on commit d8b0947

Please sign in to comment.