Skip to content

Commit

Permalink
Merge branch 'main' into dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
geritwagner committed Feb 27, 2024
2 parents 29e58a1 + adb7550 commit f86da07
Show file tree
Hide file tree
Showing 172 changed files with 1,863 additions and 2,080 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ repos:
- id: debug-statements
- id: name-tests-test
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.1.1
rev: 24.2.0
hooks:
- id: black
language_version: python3
- repo: https://github.com/PyCQA/autoflake
rev: v2.2.1
rev: v2.3.0
hooks:
- id: autoflake
- repo: https://github.com/PyCQA/flake8
Expand All @@ -46,7 +46,7 @@ repos:
- id: reorder-python-imports
args: [--py3-plus]
- repo: https://github.com/asottile/pyupgrade
rev: v3.15.0
rev: v3.15.1
hooks:
- id: pyupgrade
args: [--py36-plus, --keep-runtime-typing]
Expand All @@ -56,7 +56,7 @@ repos:
- id: mypy
args: [--disallow-untyped-defs, --disallow-incomplete-defs, --disallow-untyped-calls]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.1
rev: v0.2.2
hooks:
- id: ruff # runs faster than pylint
args: [--fix, --exit-non-zero-on-fix]
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ build:
- pip install poetry
- poetry config virtualenvs.create false
post_install:
- poetry install -E docs
- pip install .[docs]

sphinx:
configuration: docs/source/conf.py
2 changes: 1 addition & 1 deletion colrev/.colrev_endpoints.json
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
"endpoint": "colrev.ops.built_in.search_sources.trid.TransportResearchInternationalDocumentation"
},
{"package_endpoint_identifier": "colrev.semanticscholar",
"endpoint": "colrev.ops.built_in.search_sources.semanticscholar_api.SemanticScholarSearchSource"
"endpoint": "colrev.ops.built_in.search_sources.semanticscholar.SemanticScholarSearchSource"
}
],
"review_type": [
Expand Down
66 changes: 33 additions & 33 deletions colrev/advisor.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def __init__(
) -> None:
self.review_manager = review_manager

def __append_merge_conflict_warning(
def _append_merge_conflict_warning(
self, *, collaboration_instructions: dict, git_repo: git.Repo
) -> None:
found_a_conflict = False
Expand All @@ -63,7 +63,7 @@ def __append_merge_conflict_warning(
}
collaboration_instructions["items"].append(item)

def __notify_non_staged_files(
def _notify_non_staged_files(
self, *, collaboration_instructions: dict, git_repo: git.Repo
) -> None:
# Notify when changes in bib files are not staged
Expand All @@ -81,7 +81,7 @@ def __notify_non_staged_files(
}
collaboration_instructions["items"].append(item)

def __add_sharing_notifications(
def _add_sharing_notifications(
self,
*,
collaboration_instructions: dict,
Expand Down Expand Up @@ -196,7 +196,7 @@ def __add_sharing_notifications(
}

# pylint: disable=colrev-missed-constant-usage
def __get_collaboration_instructions(
def _get_collaboration_instructions(
self, *, status_stats: Optional[colrev.ops.status.StatusStats] = None
) -> dict:
"""Get instructions related to collaboration"""
Expand Down Expand Up @@ -224,20 +224,20 @@ def __get_collaboration_instructions(
}
collaboration_instructions["items"].append(item)

self.__append_merge_conflict_warning(
self._append_merge_conflict_warning(
collaboration_instructions=collaboration_instructions, git_repo=git_repo
)
if len(collaboration_instructions["items"]) > 0:
# Don't append any other instructions.
# Resolving the merge conflict is always prio 1
return collaboration_instructions

self.__notify_non_staged_files(
self._notify_non_staged_files(
collaboration_instructions=collaboration_instructions, git_repo=git_repo
)

if remote_connected:
self.__add_sharing_notifications(
self._add_sharing_notifications(
collaboration_instructions=collaboration_instructions,
status_stats=status_stats,
)
Expand All @@ -251,7 +251,7 @@ def __get_collaboration_instructions(

return collaboration_instructions

def __append_initial_load_instruction(self, *, review_instructions: list) -> None:
def _append_initial_load_instruction(self, *, review_instructions: list) -> None:
if not self.review_manager.dataset.records_file.is_file():
instruction = {
"msg": "To import, copy search results to the search directory.",
Expand All @@ -262,7 +262,7 @@ def __append_initial_load_instruction(self, *, review_instructions: list) -> Non
]:
review_instructions.append(instruction)

def __append_operation_in_progress_instructions(
def _append_operation_in_progress_instructions(
self,
*,
review_instructions: list,
Expand Down Expand Up @@ -324,7 +324,7 @@ def __append_operation_in_progress_instructions(
}
review_instructions.append(instruction)

def __append_initial_operations(
def _append_initial_operations(
self, *, review_instructions: list, status_stats: colrev.ops.status.StatusStats
) -> bool:
if not Path(self.review_manager.search_dir).iterdir():
Expand Down Expand Up @@ -356,7 +356,7 @@ def __append_initial_operations(
return True
return False

def __append_active_operations(
def _append_active_operations(
self,
*,
status_stats: colrev.ops.status.StatusStats,
Expand Down Expand Up @@ -403,7 +403,7 @@ def __append_active_operations(
]:
review_instructions.append(instruction)

def __append_data_operation_advice(self, *, review_instructions: list) -> None:
def _append_data_operation_advice(self, *, review_instructions: list) -> None:
if (
len(review_instructions) == 1
or self.review_manager.verbose_mode
Expand Down Expand Up @@ -440,27 +440,27 @@ def __append_data_operation_advice(self, *, review_instructions: list) -> None:
if advice:
review_instructions.append(advice)

def __append_next_operation_instructions(
def _append_next_operation_instructions(
self,
*,
review_instructions: list,
status_stats: colrev.ops.status.StatusStats,
current_origin_states_dict: dict,
) -> None:
if self.__append_initial_operations(
if self._append_initial_operations(
review_instructions=review_instructions, status_stats=status_stats
):
return

self.__append_active_operations(
self._append_active_operations(
status_stats=status_stats,
current_origin_states_dict=current_origin_states_dict,
review_instructions=review_instructions,
)

self.__append_data_operation_advice(review_instructions=review_instructions)
self._append_data_operation_advice(review_instructions=review_instructions)

def __get_missing_files(
def _get_missing_files(
self, *, status_stats: colrev.ops.status.StatusStats
) -> list:
# excluding pdf_not_available
Expand All @@ -482,12 +482,12 @@ def __get_missing_files(

return missing_files

def __append_pdf_issue_instructions(
def _append_pdf_issue_instructions(
self, *, status_stats: colrev.ops.status.StatusStats, review_instructions: list
) -> None:
# Check pdf files
if self.review_manager.settings.pdf_get.pdf_required_for_screen_and_synthesis:
missing_files = self.__get_missing_files(status_stats=status_stats)
missing_files = self._get_missing_files(status_stats=status_stats)
if len(missing_files) > 0:
review_instructions.append(
{
Expand Down Expand Up @@ -524,7 +524,7 @@ def __append_pdf_issue_instructions(
}
)

def __append_iteration_completed_instructions(
def _append_iteration_completed_instructions(
self, *, review_instructions: list, status_stats: colrev.ops.status.StatusStats
) -> None:
if (
Expand Down Expand Up @@ -557,32 +557,32 @@ def get_review_instructions(
review_instructions: typing.List[typing.Dict] = []
current_origin_states_dict = self.review_manager.dataset.get_origin_state_dict()

self.__append_initial_load_instruction(review_instructions=review_instructions)
self._append_initial_load_instruction(review_instructions=review_instructions)

self.__append_operation_in_progress_instructions(
self._append_operation_in_progress_instructions(
review_instructions=review_instructions,
status_stats=status_stats,
current_origin_states_dict=current_origin_states_dict,
)

self.__append_next_operation_instructions(
self._append_next_operation_instructions(
review_instructions=review_instructions,
status_stats=status_stats,
current_origin_states_dict=current_origin_states_dict,
)

self.__append_pdf_issue_instructions(
self._append_pdf_issue_instructions(
status_stats=status_stats, review_instructions=review_instructions
)

self.__append_iteration_completed_instructions(
self._append_iteration_completed_instructions(
review_instructions=review_instructions, status_stats=status_stats
)

return review_instructions

# Note : no named arguments for multiprocessing
def __append_registered_repo_instructions(self, registered_path: Path) -> dict:
def _append_registered_repo_instructions(self, registered_path: Path) -> dict:
instruction = {}

try:
Expand Down Expand Up @@ -644,7 +644,7 @@ def pull_rebase_condition() -> bool:
pass
return instruction

def __append_download_outlets_instruction(
def _append_download_outlets_instruction(
self,
environment_manager: colrev.env.environment_manager.EnvironmentManager,
environment_instructions: list,
Expand Down Expand Up @@ -698,7 +698,7 @@ def __append_download_outlets_instruction(
}
environment_instructions.append(instruction)

def __get_environment_instructions(
def _get_environment_instructions(
self, *, status_stats: colrev.ops.status.StatusStats
) -> list:
"""Get instructions related to the CoLRev environment"""
Expand All @@ -708,7 +708,7 @@ def __get_environment_instructions(
environment_instructions: list[dict] = []

if status_stats.currently.md_imported > 10:
self.__append_download_outlets_instruction(
self._append_download_outlets_instruction(
environment_manager=environment_manager,
environment_instructions=environment_instructions,
)
Expand All @@ -720,7 +720,7 @@ def __get_environment_instructions(
# it does not use a lot of CPU capacity
pool = ThreadPool(50)
add_instructions = pool.map(
self.__append_registered_repo_instructions, registered_paths
self._append_registered_repo_instructions, registered_paths
)

environment_instructions += list(filter(None, add_instructions))
Expand All @@ -746,10 +746,10 @@ def get_instructions(
"review_instructions": self.get_review_instructions(
status_stats=status_stats
),
"environment_instructions": self.__get_environment_instructions(
"environment_instructions": self._get_environment_instructions(
status_stats=status_stats
),
"collaboration_instructions": self.__get_collaboration_instructions(
"collaboration_instructions": self._get_collaboration_instructions(
status_stats=status_stats
),
}
Expand All @@ -766,7 +766,7 @@ def get_instructions(
def get_sharing_instructions(self) -> dict:
"""Get instructions related to sharing the project"""

collaboration_instructions = self.__get_collaboration_instructions()
collaboration_instructions = self._get_collaboration_instructions()

status_code = not all(
x["level"] in ["SUCCESS", "WARNING"]
Expand Down
Loading

0 comments on commit f86da07

Please sign in to comment.