Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unused functions from util.py #128

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 0 additions & 64 deletions codebasin/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import pkgutil
import tomllib
import typing
import warnings
from collections.abc import Iterable
from os.path import splitext

Expand All @@ -36,35 +35,6 @@ def ensure_png(fname):
return ensure_ext(fname, ".png")


def ensure_source(fname):
"""Return true if the path passed in specifies a source file"""
extensions = [
".s",
".asm",
".c",
".cpp",
".cxx",
".c++",
".cc",
".h",
".hpp",
".hxx",
".h++",
".hh",
".inc",
".inl",
".tcc",
".icc",
".ipp",
]
return ensure_ext(fname, extensions)


def ensure_json(fname):
"""Return true if the path passed in specifies a JSON file"""
return ensure_ext(fname, ".json")


def safe_open_write_binary(fname):
"""Open fname for (binary) writing. Truncate if not a symlink."""
fpid = os.open(
Expand Down Expand Up @@ -235,37 +205,3 @@ def _load_toml(file_object: typing.TextIO, schema_name: str) -> object:
toml_object = tomllib.load(file_object)
_validate_json(toml_object, schema_name)
return toml_object


def validate_coverage_json(json_string: str) -> bool:
"""
Validate coverage JSON string against schema.

Parameters
----------
json_string : String
The JSON string to validate.

Returns
-------
bool
True if the JSON string is valid.

Raises
------
ValueError
If the JSON string fails to validate.

TypeError
If the JSON string is not a string.
"""
warnings.warn(
"Direct access to JSON validation is deprecated.",
DeprecationWarning,
)

if not isinstance(json_string, str):
raise TypeError("Coverage must be a JSON string.")

instance = json.loads(json_string)
return _validate_json(instance, "coverage")
Loading