diff --git a/backend/btrixcloud/crawlconfigs.py b/backend/btrixcloud/crawlconfigs.py index 036d551db5..f5804e73e4 100644 --- a/backend/btrixcloud/crawlconfigs.py +++ b/backend/btrixcloud/crawlconfigs.py @@ -521,7 +521,6 @@ async def make_inactive_or_delete( status = "deleted" else: - if not await self.crawl_configs.find_one_and_update( {"_id": crawlconfig.id, "inactive": {"$ne": True}}, {"$set": query}, @@ -656,7 +655,6 @@ async def run_now( @router.delete("/{cid}") async def make_inactive(cid: str, org: Organization = Depends(org_crawl_dep)): - crawlconfig = await ops.get_crawl_config(uuid.UUID(cid), org) if not crawlconfig: diff --git a/backend/btrixcloud/crawls.py b/backend/btrixcloud/crawls.py index e3d9a1c58d..160e0ed6a3 100644 --- a/backend/btrixcloud/crawls.py +++ b/backend/btrixcloud/crawls.py @@ -687,7 +687,6 @@ async def list_single_crawl(crawl_id, org: Organization = Depends(org_viewer_dep async def scale_crawl( scale: CrawlScale, crawl_id, org: Organization = Depends(org_crawl_dep) ): - result = await crawl_manager.scale_crawl(crawl_id, org.id_str, scale.scale) if not result or not result.get("success"): raise HTTPException( @@ -740,7 +739,6 @@ async def add_exclusion( org: Organization = Depends(org_crawl_dep), user: User = Depends(user_dep), ): - return await ops.add_exclusion(crawl_id, regex, org, user) @app.delete( @@ -753,7 +751,6 @@ async def remove_exclusion( org: Organization = Depends(org_crawl_dep), user: User = Depends(user_dep), ): - return await ops.remove_exclusion(crawl_id, regex, org, user) return ops diff --git a/backend/btrixcloud/emailsender.py b/backend/btrixcloud/emailsender.py index aa74625503..8833e5eb0a 100644 --- a/backend/btrixcloud/emailsender.py +++ b/backend/btrixcloud/emailsender.py @@ -6,6 +6,7 @@ from email.message import EmailMessage + # pylint: disable=too-few-public-methods class EmailSender: """SMTP Email Sender""" diff --git a/backend/btrixcloud/k8s/crawl_job.py b/backend/btrixcloud/k8s/crawl_job.py index 6acd2874a0..bc37eac070 100644 --- a/backend/btrixcloud/k8s/crawl_job.py +++ b/backend/btrixcloud/k8s/crawl_job.py @@ -17,7 +17,7 @@ class K8SCrawlJob(K8SJobMixin, CrawlJob): async def _do_scale(self, new_scale): crawl = await self._get_crawl() if not crawl: - raise Exception("crawl_not_found") + raise RuntimeError("crawl_not_found") # if making scale smaller, ensure existing crawlers saved their data pods = [] diff --git a/backend/btrixcloud/k8s/k8sapi.py b/backend/btrixcloud/k8s/k8sapi.py index 35fc9279e1..d5b64108a9 100644 --- a/backend/btrixcloud/k8s/k8sapi.py +++ b/backend/btrixcloud/k8s/k8sapi.py @@ -4,6 +4,7 @@ from kubernetes_asyncio.stream import WsApiClient from kubernetes_asyncio.client.api_client import ApiClient + # pylint: disable=too-few-public-methods class K8sAPI: """K8S API accessors""" diff --git a/backend/btrixcloud/k8s/k8sman.py b/backend/btrixcloud/k8s/k8sman.py index 22935c2cc2..a242df2339 100644 --- a/backend/btrixcloud/k8s/k8sman.py +++ b/backend/btrixcloud/k8s/k8sman.py @@ -198,8 +198,9 @@ async def _get_storage_secret(self, storage_name): f"storage-{storage_name}", namespace=self.namespace, ) + # pylint: disable=broad-except except Exception: - # pylint: disable=broad-except,raise-missing-from + # pylint: disable=broad-exception-raised,raise-missing-from raise Exception(f"Storage {storage_name} not found") return None diff --git a/backend/btrixcloud/orgs.py b/backend/btrixcloud/orgs.py index fb8a13e7a0..6291447fd2 100644 --- a/backend/btrixcloud/orgs.py +++ b/backend/btrixcloud/orgs.py @@ -315,6 +315,7 @@ async def get_org_owners(self, org: Organization): # ============================================================================ +# pylint: disable=too-many-statements def init_orgs_api(app, mdb, user_manager, invites, user_dep: User): """Init organizations api router for /orgs""" # pylint: disable=too-many-locals @@ -422,7 +423,6 @@ async def set_role( org: Organization = Depends(org_owner_dep), user: User = Depends(user_dep), ): - other_user = await user_manager.user_db.get_by_email(update.email) if not other_user: raise HTTPException( @@ -443,7 +443,6 @@ async def invite_user_to_org( org: Organization = Depends(org_owner_dep), user: User = Depends(user_dep), ): - if await invites.invite_user( invite, user, diff --git a/backend/btrixcloud/profiles.py b/backend/btrixcloud/profiles.py index c3fca054f0..a4c80408f3 100644 --- a/backend/btrixcloud/profiles.py +++ b/backend/btrixcloud/profiles.py @@ -20,6 +20,7 @@ BROWSER_EXPIRE = 300 + # ============================================================================ class ProfileFile(BaseModel): """file from a crawl""" diff --git a/backend/btrixcloud/storages.py b/backend/btrixcloud/storages.py index f1393d4b9d..bf2032225c 100644 --- a/backend/btrixcloud/storages.py +++ b/backend/btrixcloud/storages.py @@ -99,7 +99,7 @@ async def get_presigned_url(org, crawlfile, crawl_manager, duration=3600): s3storage = org.storage else: - raise Exception("No Default Storage Found, Invalid Storage Type") + raise TypeError("No Default Storage Found, Invalid Storage Type") async with get_s3_client(s3storage, s3storage.use_access_for_presign) as ( client, diff --git a/backend/btrixcloud/users.py b/backend/btrixcloud/users.py index 3181454f7a..f35f865a9c 100644 --- a/backend/btrixcloud/users.py +++ b/backend/btrixcloud/users.py @@ -475,7 +475,6 @@ async def get_invite_info(token: str, email: str): async def get_existing_user_invite_info( token: str, user: User = Depends(current_active_user) ): - try: invite = user.invites[token] except: