Skip to content

Commit

Permalink
. d updated markdown snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Sep 29, 2024
1 parent 0f7b057 commit 62118c7
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
10 changes: 8 additions & 2 deletions approval_utilities/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,13 @@ def is_windows_os() -> bool:
def create_empty_file(file_path: str) -> None:
try:
import empty_files.empty_files

empty_files.empty_files.create_empty_file(file_path)
except ImportError as e:
print("Error importing empty_files", e)
raise


def ensure_file_exists(approved_path: str) -> None:
print("approved_path check", approved_path)
if not os.path.isfile(approved_path):
Expand All @@ -82,7 +85,10 @@ def print_grid(width, height, cell_print_func):
result += "\n"
return result


_V = TypeVar("_V")
_K = TypeVar("_K")
def filter_values(filter: Callable[[_V],bool], a_dict: Dict[_K,_V]) -> Dict[_K,_V]:
return {k: v for k, v in a_dict.items() if filter(v)}


def filter_values(filter: Callable[[_V], bool], a_dict: Dict[_K, _V]) -> Dict[_K, _V]:
return {k: v for k, v in a_dict.items() if filter(v)}
9 changes: 4 additions & 5 deletions approvaltests/reporters/generic_diff_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,10 @@ def __init__(self, config: GenericDiffReporterConfig) -> None:
self.extra_args = config.extra_args

def __str__(self) -> str:
config = filter_values(lambda v: bool(v), {
"name": self.name,
"path": self.path,
"arguments": self.extra_args
})
config = filter_values(
lambda v: bool(v),
{"name": self.name, "path": self.path, "arguments": self.extra_args},
)
return to_json(config)

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion approvaltests/reporters/report_with_beyond_compare.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ class ReportWithBeyondCompareMac(GenericDiffReporter):
def __init__(self):
super().__init__(
config=GenericDiffReporterConfig(
name=self.__class__.__name__, path='/Applications/Beyond Compare.app/Contents/MacOS/BCompare'
name=self.__class__.__name__,
path="/Applications/Beyond Compare.app/Contents/MacOS/BCompare",
)
)

Expand Down
1 change: 1 addition & 0 deletions docs/Contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* [Zoom Link](#zoom-link)
* [Requirements](#requirements)
* [Opening Notice](#opening-notice)
* [Startup Checklist](#startup-checklist)
* [Anydesk](#anydesk)
* [Solo Developement](#solo-developement)<!-- endToc -->

Expand Down
2 changes: 1 addition & 1 deletion mob-sessions-retros/2024-09-15-retro.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ What should we change next time?
- Never launched mobtimer.
- Startup checklist:
- Run all the tests
- Start the mobtimer
- Start the mobtimer
18 changes: 10 additions & 8 deletions tests/test_build.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import os
import ast


def test_no_imports_from_build_directory():
# Make sure no file imports from build
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
root_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
for dirpath, dirnames, filenames in os.walk(root_dir):
# Exclude directories that start with '.'
dirnames[:] = [d for d in dirnames if not d.startswith('.') and d != 'build']
dirnames[:] = [d for d in dirnames if not d.startswith(".") and d != "build"]
# also exclude venv
dirnames[:] = [d for d in dirnames if not d.startswith('venv'
)]
dirnames[:] = [d for d in dirnames if not d.startswith("venv")]
for filename in filenames:
# Skip files that start with '.' and non-Python files
if filename.startswith('.') or not filename.endswith('.py'):
if filename.startswith(".") or not filename.endswith(".py"):
continue
file_path = os.path.join(dirpath, filename)
with open(file_path, 'r', encoding='utf-8') as file:
with open(file_path, "r", encoding="utf-8") as file:
source = file.read()
try:
tree = ast.parse(source, filename=file_path)
Expand All @@ -24,8 +24,10 @@ def test_no_imports_from_build_directory():
for node in ast.walk(tree):
if isinstance(node, ast.Import):
for alias in node.names:
if alias.name == 'build' or alias.name.startswith('build.'):
if alias.name == "build" or alias.name.startswith("build."):
assert False, f"{file_path} imports 'build'"
elif isinstance(node, ast.ImportFrom):
if node.module == 'build' or (node.module and node.module.startswith('build.')):
if node.module == "build" or (
node.module and node.module.startswith("build.")
):
assert False, f"{file_path} imports from 'build'"

0 comments on commit 62118c7

Please sign in to comment.