Skip to content

Commit

Permalink
Fix pylint errors on queue-services
Browse files Browse the repository at this point in the history
  • Loading branch information
leodube-aot committed Jan 30, 2024
1 parent 83697d9 commit 7329516
Show file tree
Hide file tree
Showing 17 changed files with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, app: Flask = None):
self._publisher = None

if app:
self.app_init(app)
self.init_app(app)

def init_app(self, app: Flask):
self.gcp_auth_key = app.config.get("GCP_AUTH_KEY")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, app: Flask = None):
self._publisher = None

if app:
self.app_init(app)
self.init_app(app)

def init_app(self, app: Flask):
self.gcp_auth_key = app.config.get("GCP_AUTH_KEY")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, app: Flask = None):
self._publisher = None

if app:
self.app_init(app)
self.init_app(app)

def init_app(self, app: Flask):
self.gcp_auth_key = app.config.get("GCP_AUTH_KEY")
Expand Down
2 changes: 1 addition & 1 deletion queue_services/entity-emailer/tests/unit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,7 @@ def prep_cp_special_resolution_correction_upload_memorandum_filing(
del filing_template["filing"]["correction"]["resolution"]
filing_template["filing"]["correction"]["memorandumFileKey"] = "28f73dc4-8e7c-4c89-bef6-a81dff909ca6.pdf"
filing_template["filing"]["correction"]["memorandumFileName"] = "test.pdf"
filing = create_filing(token=payment_id, filing_json=filing_template, business_id=business.id)
filing = create_filing(token=payment_id, filing_json=filing_template, legal_entity_id=business.id)
filing.payment_completion_date = filing.filing_date
# Triggered from the filer.
filing._meta_data = {"correction": {"uploadNewMemorandum": True}}
Expand Down
2 changes: 2 additions & 0 deletions queue_services/entity-filer/src/entity_filer/common/enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class BaseMeta(EnumMeta):
def __contains__(self, other):
"""Return True if 'in' the Enum."""
try:
# pylint: disable-next=no-value-for-parameter
self(other)
except ValueError:
return False
Expand All @@ -37,6 +38,7 @@ def get_enum_by_name(cls, value: str) -> Optional[str]:
return enum_value
return None

# pylint: disable-next=no-self-argument
def _generate_next_value_(name, start, count, last_values):
"""Return the name of the key."""
return name
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

import dpath

# from entity_filer.exceptions import DefaultException, logger
from entity_filer.exceptions import DefaultException, logger
from business_model import LegalEntity, Filing

from entity_filer.filing_meta import FilingMeta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import sentry_sdk

# from entity_filer.exceptions import DefaultException
from entity_filer.exceptions import DefaultException
from business_model import db, AmalgamatingBusiness, Amalgamation, LegalEntity, Document, Filing, RegistrationBootstrap

# from legal_api.services.bootstrap import AccountService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from datetime import datetime
from typing import Dict

# from entity_filer.exceptions import DefaultException, logger
from entity_filer.exceptions import DefaultException, logger
from business_model import LegalEntity, PartyRole

from entity_filer.filing_meta import FilingMeta
Expand Down Expand Up @@ -67,7 +67,7 @@ def process(business: LegalEntity, filing: Dict, filing_meta: FilingMeta): # py

if "appointed" in new_director["actions"]:
# add new diretor party role to the business
party = merge_party(business_id=business.id, party_info=new_director)
party = merge_party(legal_entity_id=business.id, party_info=new_director)
role = {
"roleType": "Director",
"appointmentDate": new_director.get("appointmentDate"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def process(
)
case _: # LegalEntity.EntityTypes.SOLE_PROP: # legal_entity might be a proprietor?
update_proprietor_change(
legal_entity=legal_entity,
filing_type="changeOfRegistration",
change_filing_rec=change_filing_rec,
change_filing=change_filing,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"""
# pylint: disable=superfluous-parens; as pylance requires it
from contextlib import suppress
from http import HTTPStatus
from typing import Dict

import dpath
Expand Down Expand Up @@ -58,7 +59,9 @@ def process(
# Extract the filing information for incorporation
filing_meta.conversion = {}
if not (conversion_filing := filing.get("filing", {}).get("conversion")):
raise BusinessException(f"CONVL legal_filing:conversion missing from {filing_rec.id}")
raise BusinessException(
error=f"CONVL legal_filing:conversion missing from {filing_rec.id}",
status_code=HTTPStatus.BAD_REQUEST)
# if legal_entity and legal_entity.entity_type in ['SP', 'GP']:
if filing["filing"]["business"]["legalType"] in ["SP", "GP"]:
if legal_entity and not legal_entity.entity_type in [
Expand All @@ -75,17 +78,23 @@ def process(

def _process_corps_conversion(legal_entity, conversion_filing, filing, filing_rec):
if legal_entity:
raise BusinessException(f"Business Already Exist: CONVL legal_filing:conversion {filing_rec.id}")
raise BusinessException(
error=f"Business Already Exist: CONVL legal_filing:conversion {filing_rec.id}",
status_code=HTTPStatus.FORBIDDEN)
if not (corp_num := filing.get("filing", {}).get("business", {}).get("identifier")):
raise BusinessException(f"conversion {filing_rec.id} missing the legal_entity identifier.")
raise BusinessException(
error=f"conversion {filing_rec.id} missing the legal_entity identifier.",
status_code=HTTPStatus.BAD_REQUEST)
# Initial insert of the legal_entity record
legal_entity_info_obj = conversion_filing.get("nameRequest")
if not (
legal_entity := legal_entity_info.update_legal_entity_info(
corp_num, LegalEntity(), legal_entity_info_obj, filing_rec
)
):
raise BusinessException(f"CONVL conversion {filing_rec.id}, Unable to create legal_entity.")
raise BusinessException(
error=f"CONVL conversion {filing_rec.id}, Unable to create legal_entity.",
status_code=HTTPStatus.UNPROCESSABLE_ENTITY)
if offices := conversion_filing.get("offices"):
update_offices(legal_entity, offices)
if parties := conversion_filing.get("parties"):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
create_role,
filings,
legal_entity_info,
merge_party,
resolutions,
rules_and_memorandum,
shares,
Expand Down Expand Up @@ -215,7 +216,7 @@ def _update_party(party_info):


def _create_party_info(business, correction_filing_rec, party_info):
party = merge_party(business_id=business.id, party_info=party_info, create=False)
party = merge_party(legal_entity_id=business.id, party_info=party_info, create=False)
for role_type in party_info.get("roles"):
role_str = role_type.get("roleType", "").lower()
role = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ def update_naics_info(legal_entity: LegalEntity, naics: Dict):
# TODO update NAICS info
legal_entity.naics_code = naics.get("naicsCode")
if legal_entity.naics_code:
naics_structure = NaicsService.find_by_code(legal_entity.naics_code)
legal_entity.naics_key = naics_structure["naicsKey"]
# TODO: Uncomment next 2 lines when find_by_code implemented and delete "pass"
# naics_structure = NaicsService.find_by_code(legal_entity.naics_code)
# legal_entity.naics_key = naics_structure["naicsKey"]
pass
else:
legal_entity.naics_code = None
legal_entity.naics_key = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import sentry_sdk

# from entity_filer.exceptions import DefaultException
from entity_filer.exceptions import DefaultException
from business_model import LegalEntity, Document, Filing, RegistrationBootstrap
from business_model.models.document import DocumentType

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

import dpath

# from entity_filer.exceptions import DefaultException, logger
from entity_filer.exceptions import DefaultException, logger
from business_model import LegalEntity, Filing

from entity_filer.filing_meta import FilingMeta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"""File processing rules and actions for the transition of a business."""
from typing import Dict

# from entity_filer.exceptions import DefaultException
from entity_filer.exceptions import DefaultException
from business_model import LegalEntity, Filing

from entity_filer.filing_meta import FilingMeta
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, app: Flask = None):
self._publisher = None

if app:
self.app_init(app)
self.init_app(app)

def init_app(self, app: Flask):
self.gcp_auth_key = app.config.get("GCP_AUTH_KEY")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def __init__(self, app: Flask = None):
self._publisher = None

if app:
self.app_init(app)
self.init_app(app)

def init_app(self, app: Flask):
self.gcp_auth_key = app.config.get("GCP_AUTH_KEY")
Expand Down

0 comments on commit 7329516

Please sign in to comment.