mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-25 03:58:39 +02:00
Linting
This commit is contained in:
parent
f7c82ac957
commit
5b4a357069
8 changed files with 50 additions and 33 deletions
|
@ -192,10 +192,9 @@ class Command(BaseCommand):
|
|||
|
||||
# ---- UPDATE THE DOMAIN
|
||||
# update the status
|
||||
self.update_domain_status(
|
||||
transition_domain, target_domain, debug_on
|
||||
)
|
||||
# TODO: not all domains need to be updated (the information is the same).
|
||||
self.update_domain_status(transition_domain, target_domain, debug_on)
|
||||
# TODO: not all domains need to be updated
|
||||
# (the information is the same).
|
||||
# Need to bubble this up to the final report.
|
||||
|
||||
# update dates (creation and expiration)
|
||||
|
@ -493,7 +492,9 @@ class Command(BaseCommand):
|
|||
self.update_domain_information(
|
||||
target_domain_information, template_domain_information, debug_on
|
||||
)
|
||||
# TODO: not all domains need to be updated (the information is the same). Need to bubble this up to the final report.
|
||||
# TODO: not all domains need to be updated
|
||||
# (the information is the same).
|
||||
# Need to bubble this up to the final report.
|
||||
|
||||
return (target_domain_information, domain, False)
|
||||
except DomainInformation.MultipleObjectsReturned:
|
||||
|
@ -594,8 +595,11 @@ class Command(BaseCommand):
|
|||
debug_on,
|
||||
f"{TerminalColors.OKCYAN}"
|
||||
"Processing Transition Domain: "
|
||||
f"{transition_domain_name}, {transition_domain_status}, {transition_domain_email}"
|
||||
f", {transition_domain_creation_date}, {transition_domain_expiration_date}"
|
||||
f"{transition_domain_name},"
|
||||
f" {transition_domain_status},"
|
||||
f" {transition_domain_email}"
|
||||
f", {transition_domain_creation_date}, "
|
||||
f"{transition_domain_expiration_date}"
|
||||
f"{TerminalColors.ENDC}", # noqa
|
||||
)
|
||||
|
||||
|
@ -680,7 +684,8 @@ class Command(BaseCommand):
|
|||
else:
|
||||
# Raise an err for now
|
||||
raise Exception(
|
||||
f"Domain {existing_domain} wants to be added but doesn't exist in the DB"
|
||||
f"Domain {existing_domain} wants to be added"
|
||||
"but doesn't exist in the DB"
|
||||
)
|
||||
invitation.save()
|
||||
|
||||
|
@ -740,7 +745,9 @@ class Command(BaseCommand):
|
|||
),
|
||||
None,
|
||||
)
|
||||
# TODO: this is redundant. Currently debugging....running into unique key constraint error....
|
||||
# TODO: this is redundant.
|
||||
# Currently debugging....
|
||||
# running into unique key constraint error....
|
||||
existing_domain_info = DomainInformation.objects.filter(
|
||||
domain__name=target_domain_information.domain.name
|
||||
).exists()
|
||||
|
@ -765,7 +772,8 @@ class Command(BaseCommand):
|
|||
f"updated domain information: {target_domain_information}"
|
||||
)
|
||||
else:
|
||||
debug_string = f"domain information already exists and matches incoming data (NO CHANGES MADE): {target_domain_information}"
|
||||
debug_string = "domain information already exists and "
|
||||
f"matches incoming data (NO CHANGES MADE): {target_domain_information}"
|
||||
|
||||
# DEBUG:
|
||||
TerminalHelper.print_conditional(
|
||||
|
|
|
@ -4,7 +4,7 @@ A list of helper classes to facilitate handling data from verisign data exports.
|
|||
Regarding our dataclasses:
|
||||
Not intended to be used as models but rather as an alternative to storing as a dictionary.
|
||||
By keeping it as a dataclass instead of a dictionary, we can maintain data consistency.
|
||||
"""
|
||||
""" # noqa
|
||||
from dataclasses import dataclass, field
|
||||
from datetime import date
|
||||
from enum import Enum
|
||||
|
|
|
@ -239,6 +239,7 @@ class LoadExtraTransitionDomain:
|
|||
total_transition_domains = len(updated_transition_domains)
|
||||
total_updates_made = TransitionDomain.objects.all().count()
|
||||
if total_transition_domains != total_updates_made:
|
||||
# noqa here for line length
|
||||
logger.error(
|
||||
f"""{TerminalColors.FAIL}
|
||||
WARNING: something went wrong processing domain information data.
|
||||
|
@ -251,7 +252,7 @@ class LoadExtraTransitionDomain:
|
|||
corrupt data. Please check logs to diagnose.
|
||||
|
||||
----- TERMINATING ----
|
||||
"""
|
||||
""" # noqa
|
||||
)
|
||||
sys.exit()
|
||||
|
||||
|
@ -654,7 +655,7 @@ class FileDataHolder:
|
|||
id_field: data_type(...),
|
||||
...
|
||||
}
|
||||
"""
|
||||
""" # noqa
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
|
@ -664,18 +665,18 @@ class FileDataHolder:
|
|||
id_field: str,
|
||||
):
|
||||
# Metadata #
|
||||
## Filename inference metadata ##
|
||||
# = Filename inference metadata =#
|
||||
self.regex = regex
|
||||
self.could_infer = False
|
||||
|
||||
## "data" object metadata ##
|
||||
### Where the data is sourced from ###
|
||||
# = "data" object metadata =#
|
||||
# == Where the data is sourced from ==#
|
||||
self.filename = filename
|
||||
|
||||
### What type the data is ###
|
||||
# == What type the data is ==#
|
||||
self.data_type = data_type
|
||||
|
||||
### What the id should be in the holding dict ###
|
||||
# == What the id should be in the holding dict ==#
|
||||
# TODO - rename to id_field_name
|
||||
self.id_field = id_field
|
||||
|
||||
|
@ -868,8 +869,10 @@ class ExtraTransitionDomain:
|
|||
continue
|
||||
|
||||
# Infer filename logic #
|
||||
# This mode is used for internal development use and testing only. Rather than having
|
||||
# to manually define the filename each time, we can infer what the filename
|
||||
# This mode is used for
|
||||
# internal development use and testing only.
|
||||
# Rather than havingto manually define the
|
||||
# filename each time, we can infer what the filename
|
||||
# actually is.
|
||||
|
||||
# Not intended for use outside of that, as it is better to assume
|
||||
|
|
|
@ -180,7 +180,7 @@ class TerminalHelper:
|
|||
|
||||
# If the user decided to proceed return true.
|
||||
# Otherwise, either return false or exit this subroutine.
|
||||
if proceed_execution == False:
|
||||
if not proceed_execution:
|
||||
if system_exit_on_terminate:
|
||||
sys.exit()
|
||||
return False
|
||||
|
@ -206,7 +206,9 @@ class TerminalHelper:
|
|||
filepath = f"{file_directory}{filename}.txt"
|
||||
# Write to file
|
||||
logger.info(
|
||||
f"{TerminalColors.MAGENTA}Writing to file {filepath}...{TerminalColors.ENDC}"
|
||||
f"{TerminalColors.MAGENTA}Writing to file "
|
||||
f" {filepath}..."
|
||||
f"{TerminalColors.ENDC}"
|
||||
)
|
||||
with open(f"{filepath}", "w+") as f:
|
||||
f.write(file_contents)
|
||||
|
@ -233,7 +235,7 @@ class TerminalHelper:
|
|||
length - Optional : character length of bar (Int)
|
||||
fill - Optional : bar fill character (Str)
|
||||
printEnd - Optional : end character (e.g. "\r", "\r\n") (Str)
|
||||
"""
|
||||
""" # noqa
|
||||
|
||||
"""
|
||||
# Initial call to print 0% progress
|
||||
|
@ -243,7 +245,7 @@ class TerminalHelper:
|
|||
time.sleep(0.1)
|
||||
# Update Progress Bar
|
||||
printProgressBar(i + 1, l, prefix = 'Progress:', suffix = 'Complete', length = 50)
|
||||
"""
|
||||
""" # noqa
|
||||
|
||||
percent = ("{0:." + str(decimals) + "f}").format(
|
||||
100 * (iteration / float(total))
|
||||
|
|
|
@ -36,7 +36,7 @@ class TransitionDomainArguments:
|
|||
limitParse: Optional[int] = field(default=None, repr=True)
|
||||
|
||||
# Filenames #
|
||||
## Adhocs ##
|
||||
# = Adhocs =#
|
||||
agency_adhoc_filename: Optional[str] = field(
|
||||
default=EnumFilenames.AGENCY_ADHOC.value[1], repr=True
|
||||
)
|
||||
|
@ -50,7 +50,7 @@ class TransitionDomainArguments:
|
|||
default=EnumFilenames.AUTHORITY_ADHOC.value[1], repr=True
|
||||
)
|
||||
|
||||
## Data files ##
|
||||
# = Data files =#
|
||||
domain_escrow_filename: Optional[str] = field(
|
||||
default=EnumFilenames.DOMAIN_ESCROW.value[1], repr=True
|
||||
)
|
||||
|
|
|
@ -47,8 +47,10 @@ class TestMigrations(TestCase):
|
|||
UserDomainRole.objects.all().delete()
|
||||
|
||||
def run_load_domains(self):
|
||||
# noqa here because splitting this up makes it confusing.
|
||||
# ES501
|
||||
with patch(
|
||||
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit",
|
||||
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit", # noqa
|
||||
return_value=True,
|
||||
):
|
||||
call_command(
|
||||
|
@ -61,8 +63,10 @@ class TestMigrations(TestCase):
|
|||
call_command("transfer_transition_domains_to_domains")
|
||||
|
||||
def run_master_script(self):
|
||||
# noqa here (E501) because splitting this up makes it
|
||||
# confusing to read.
|
||||
with patch(
|
||||
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit",
|
||||
"registrar.management.commands.utility.terminal_helper.TerminalHelper.query_yes_no_exit", # noqa
|
||||
return_value=True,
|
||||
):
|
||||
call_command(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue