removed useless def comments that started with and underscore as well

This commit is contained in:
jasquat 2023-06-01 13:52:07 -04:00
parent 80577c6389
commit b756e594ab
21 changed files with 1 additions and 33 deletions

View File

@ -63,7 +63,7 @@ remove_useless_comments() {
# if [[ -n "$matches" ]]; then
# fi
sed -Ei 's/^(\s*)"""[A-Z]\w*Error\."""/\1pass/' "$file_name"
sed -Ei '/^\s*"""[A-Z]\w*\."""/d' "$file_name"
sed -Ei '/^\s*"""[A-Z_]\w*\."""/d' "$file_name"
}
# Process each Python file in the "src" and "tests" directories

View File

@ -73,7 +73,6 @@ class File:
file_contents_hash: str | None = None
def __post_init__(self) -> None:
"""__post_init__."""
self.sort_index = f"{self.type}:{self.name}"
@classmethod

View File

@ -21,7 +21,6 @@ class PermissionTargetModel(SpiffworkflowBaseDBModel):
uri: str = db.Column(db.String(255), unique=True, nullable=False)
def __init__(self, uri: str, id: int | None = None):
"""__init__."""
if id:
self.id = id
uri_with_percent = re.sub(r"\*", "%", uri)

View File

@ -28,11 +28,9 @@ class ProcessGroup:
parent_groups: list[ProcessGroupLite] | None = None
def __post_init__(self) -> None:
"""__post_init__."""
self.sort_index = self.display_name
def __eq__(self, other: Any) -> bool:
"""__eq__."""
if not isinstance(other, ProcessGroup):
return False
if other.id == self.id:

View File

@ -198,7 +198,6 @@ class ProcessInstanceApi:
process_model_display_name: str,
updated_at_in_seconds: int,
) -> None:
"""__init__."""
self.id = id
self.status = status
self.next_task = next_task # The next task that requires user input.

View File

@ -58,15 +58,12 @@ class ProcessInstanceReportResult(TypedDict):
# https://stackoverflow.com/a/56842689/6090676
class Reversor:
def __init__(self, obj: Any):
"""__init__."""
self.obj = obj
def __eq__(self, other: Any) -> Any:
"""__eq__."""
return other.obj == self.obj
def __lt__(self, other: Any) -> Any:
"""__lt__."""
return other.obj < self.obj

View File

@ -40,11 +40,9 @@ class ProcessModelInfo:
bpmn_version_control_identifier: str | None = None
def __post_init__(self) -> None:
"""__post_init__."""
self.sort_index = self.id
def __eq__(self, other: Any) -> bool:
"""__eq__."""
if not isinstance(other, ProcessModelInfo):
return False
if other.id == self.id:

View File

@ -124,7 +124,6 @@ class Task:
calling_subprocess_task_id: str | None = None,
error_message: str | None = None,
):
"""__init__."""
self.id = id
self.name = name
self.title = title

View File

@ -639,7 +639,6 @@ def _get_process_instance(
process_instance: ProcessInstanceModel,
process_identifier: str | None = None,
) -> flask.wrappers.Response:
"""_get_process_instance."""
process_model_identifier = modified_process_model_identifier.replace(":", "/")
try:
current_version_control_revision = GitService.get_current_revision()
@ -683,7 +682,6 @@ def _get_process_instance(
def _find_process_instance_for_me_or_raise(
process_instance_id: int,
) -> ProcessInstanceModel:
"""_find_process_instance_for_me_or_raise."""
process_instance: ProcessInstanceModel | None = (
ProcessInstanceModel.query.filter_by(id=process_instance_id)
.outerjoin(HumanTaskModel)

View File

@ -452,7 +452,6 @@ def _get_file_from_request() -> FileStorage:
def _get_process_group_from_modified_identifier(
modified_process_group_id: str,
) -> ProcessGroup:
"""_get_process_group_from_modified_identifier."""
if modified_process_group_id is None:
raise ApiError(
error_code="process_group_id_not_specified",
@ -480,7 +479,6 @@ def _create_or_update_process_model_file(
http_status_to_return: int,
file_contents_hash: str | None = None,
) -> flask.wrappers.Response:
"""_create_or_update_process_model_file."""
process_model_identifier = modified_process_model_identifier.replace(":", "/")
process_model = _get_process_model(process_model_identifier)
request_file = _get_file_from_request()

View File

@ -793,7 +793,6 @@ def _update_form_schema_with_task_data_as_needed(in_dict: dict, task_model: Task
def _get_potential_owner_usernames(assigned_user: AliasedClass) -> Any:
"""_get_potential_owner_usernames."""
potential_owner_usernames_from_group_concat_or_similar = func.group_concat(
assigned_user.username.distinct()
).label("potential_owner_usernames")

View File

@ -366,7 +366,6 @@ def get_user_from_decoded_internal_token(decoded_token: dict) -> UserModel | Non
def _clear_auth_tokens_from_thread_local_data() -> None:
"""_clear_auth_tokens_from_thread_local_data."""
tld = current_app.config["THREAD_LOCAL_DATA"]
if hasattr(tld, "new_access_token"):
delattr(tld, "new_access_token")

View File

@ -161,7 +161,6 @@ class Script:
@staticmethod
def _get_all_subclasses(script_class: Any) -> list[type[Script]]:
"""_get_all_subclasses."""
# hackish mess to make sure we have all the modules loaded for the scripts
pkg_dir = os.path.dirname(__file__)
for _module_loader, name, _ispkg in pkgutil.iter_modules([pkg_dir]):

View File

@ -9,7 +9,6 @@ class BackgroundProcessingService:
"""Used to facilitate doing work outside of an HTTP request/response."""
def __init__(self, app: flask.app.Flask):
"""__init__."""
self.app = app
def process_not_started_process_instances(self) -> None:

View File

@ -111,12 +111,10 @@ class FileSystemService:
@staticmethod
def _timestamp(file_path: str) -> float:
"""_timestamp."""
return os.path.getmtime(file_path)
@staticmethod
def _last_modified(file_path: str) -> datetime:
"""_last_modified."""
# Returns the last modified date of the given file.
timestamp = os.path.getmtime(file_path)
utc_dt = datetime.utcfromtimestamp(timestamp)

View File

@ -39,7 +39,6 @@ class JsonFormatter(logging.Formatter):
time_format: str = "%Y-%m-%dT%H:%M:%S",
msec_format: str = "%s.%03dZ",
):
"""__init__."""
self.fmt_dict = fmt_dict if fmt_dict is not None else {"message": "message"}
self.default_time_format = time_format
self.default_msec_format = msec_format

View File

@ -89,7 +89,6 @@ StartEvent.register_converter(SPIFF_SPEC_CONFIG)
def _import(name: str, glbls: dict[str, Any], *args: Any) -> None:
"""_import."""
if name not in glbls:
raise ImportError(f"Import not allowed: {name}", name=name)
@ -261,7 +260,6 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
"""
def __init__(self) -> None:
"""__init__."""
default_globals = {
"_strptime": _strptime,
"dateparser": dateparser,
@ -287,7 +285,6 @@ class CustomBpmnScriptEngine(PythonScriptEngine): # type: ignore
super().__init__(environment=environment)
def __get_augment_methods(self, task: SpiffTask | None) -> dict[str, Callable]:
"""__get_augment_methods."""
tld = current_app.config.get("THREAD_LOCAL_DATA")
process_model_identifier = None
process_instance_id = None

View File

@ -283,7 +283,6 @@ class ProcessInstanceReportService:
@classmethod
def _get_potential_owner_usernames(cls, assigned_user: AliasedClass) -> Any:
"""_get_potential_owner_usernames."""
potential_owner_usernames_from_group_concat_or_similar = func.group_concat(
assigned_user.username.distinct()
).label("potential_owner_usernames")

View File

@ -366,7 +366,6 @@ class ProcessModelService(FileSystemService):
@classmethod
def __scan_process_groups(cls, process_group_id: str | None = None) -> list[ProcessGroup]:
"""__scan_process_groups."""
if not os.path.exists(FileSystemService.root_path()):
return [] # Nothing to scan yet. There are no files.
if process_group_id is not None:
@ -441,7 +440,6 @@ class ProcessModelService(FileSystemService):
path: str,
name: str | None = None,
) -> ProcessModelInfo:
"""__scan_process_model."""
json_file_path = os.path.join(path, cls.PROCESS_MODEL_JSON_FILE)
if os.path.exists(json_file_path):

View File

@ -77,7 +77,6 @@ class ExecutionStrategy:
"""Interface of sorts for a concrete execution strategy."""
def __init__(self, delegate: EngineStepDelegate, subprocess_spec_loader: SubprocessSpecLoader):
"""__init__."""
self.delegate = delegate
self.subprocess_spec_loader = subprocess_spec_loader
@ -375,7 +374,6 @@ class WorkflowExecutionService:
process_instance_completer: ProcessInstanceCompleter,
process_instance_saver: ProcessInstanceSaver,
):
"""__init__."""
self.bpmn_process_instance = bpmn_process_instance
self.process_instance_model = process_instance_model
self.execution_strategy = execution_strategy
@ -497,7 +495,6 @@ class ProfiledWorkflowExecutionService(WorkflowExecutionService):
"""A profiled version of the workflow execution service."""
def run_and_save(self, exit_at: None = None, save: bool = False) -> None:
"""__do_engine_steps."""
import cProfile
from pstats import SortKey

View File

@ -31,7 +31,6 @@ class TestUsersController(BaseTest):
username_prefix: str,
expected_count: int,
) -> None:
"""_assert_search_has_count."""
response = client.get(
f"/v1.0/users/search?username_prefix={username_prefix}",
headers=self.logged_in_headers(with_super_admin_user),