diff --git a/warg/__init__.py b/warg/__init__.py index dc678c6..9f5b9e0 100644 --- a/warg/__init__.py +++ b/warg/__init__.py @@ -8,7 +8,7 @@ __project__ = "Warg" __author__ = "Christian Heider Nielsen" -__version__ = "1.1.3" +__version__ = "1.1.4" __doc__ = r""" Created on 27/04/2019 diff --git a/warg/ast_ops/first_arg_identifier.py b/warg/ast_ops/first_arg_identifier.py index 38b42e5..313ace6 100644 --- a/warg/ast_ops/first_arg_identifier.py +++ b/warg/ast_ops/first_arg_identifier.py @@ -111,7 +111,10 @@ def visit_Call(self, node: ast.AST) -> None: def get_first_arg_name( - func_name: str, *, verbose=False, max_num_intermediate_unnamed_elements=-1 # recurse = -1 + func_name: str, + *, + verbose=False, + max_num_intermediate_unnamed_elements=-1, # recurse = -1 ) -> Optional[str]: """description""" import inspect diff --git a/warg/config_shell.py b/warg/config_shell.py index 2b29142..f00ccf1 100644 --- a/warg/config_shell.py +++ b/warg/config_shell.py @@ -116,7 +116,12 @@ def add_property_options(self, ps: PropertySettings) -> None: self.add_option(p, getter=getter, setter=setter, deleter=deleter) def add_option( - self, key: str, *, getter: callable, setter: callable, deleter: Optional[callable] = None + self, + key: str, + *, + getter: callable, + setter: callable, + deleter: Optional[callable] = None, ) -> None: """ diff --git a/warg/decorators/kw_passing.py b/warg/decorators/kw_passing.py index 2cf182f..aa0a0b8 100644 --- a/warg/decorators/kw_passing.py +++ b/warg/decorators/kw_passing.py @@ -229,7 +229,11 @@ def wrapper(*args, **kwargs: MutableMapping) -> Any: def pack_args( - f: callable, *, pack_name: str = "arg_pack", allow_passing: bool = True, verbose: bool = False + f: callable, + *, + pack_name: str = "arg_pack", + allow_passing: bool = True, + verbose: bool = False, ) -> callable: """ @@ -269,7 +273,11 @@ def wrapper(*args, **kwargs: MutableMapping) -> Any: def pack_kws( - f: callable, *, pack_name: str = "kw_pack", allow_passing: bool = True, verbose: bool = False + f: callable, + *, + pack_name: str = "kw_pack", + allow_passing: bool = True, + verbose: bool = False, ) -> callable: """ @@ -309,7 +317,11 @@ def wrapper(*args, **kwargs: MutableMapping) -> Any: def pack_args_and_kws( - f: callable, *, pack_name: str = "arg_kw_pack", allow_passing: bool = True, verbose: bool = False + f: callable, + *, + pack_name: str = "arg_kw_pack", + allow_passing: bool = True, + verbose: bool = False, ) -> callable: """ diff --git a/warg/functions.py b/warg/functions.py index f30f8f6..5efcd71 100644 --- a/warg/functions.py +++ b/warg/functions.py @@ -29,7 +29,17 @@ from collections import defaultdict from copy import deepcopy from functools import reduce -from typing import Any, Callable, Dict, Iterable, Iterator, Mapping, Sequence, Tuple, List +from typing import ( + Any, + Callable, + Dict, + Iterable, + Iterator, + Mapping, + Sequence, + Tuple, + List, +) from warg import Number, drop_unused_kws diff --git a/warg/generators/filtering.py b/warg/generators/filtering.py index 5aadfa3..93dd3b0 100644 --- a/warg/generators/filtering.py +++ b/warg/generators/filtering.py @@ -23,7 +23,11 @@ class FilterModeEnum(Enum): # exclude_postfix, exclude_prefix, exclude_fully = assigned_names() # TODO: Include variants - exclude_postfix, exclude_prefix, exclude_fully = "exclude_postfix", "exclude_prefix", "exclude_fully" + exclude_postfix, exclude_prefix, exclude_fully = ( + "exclude_postfix", + "exclude_prefix", + "exclude_fully", + ) def symbol_filter( diff --git a/warg/math_utilities/ordinals.py b/warg/math_utilities/ordinals.py index a5a3243..6330a02 100644 --- a/warg/math_utilities/ordinals.py +++ b/warg/math_utilities/ordinals.py @@ -109,5 +109,14 @@ def prev_odd(v: Number) -> Number: for a in numpy.arange(-1.0, 10.0, 0.5): cprint(a) - for f in (ceil_odd, ceil_even, floor_even, floor_odd, next_even, next_odd, prev_even, prev_odd): + for f in ( + ceil_odd, + ceil_even, + floor_even, + floor_odd, + next_even, + next_odd, + prev_even, + prev_odd, + ): print(f.__name__, f(a)) diff --git a/warg/os_utilities/os_platform.py b/warg/os_utilities/os_platform.py index 7267dff..183d1e3 100644 --- a/warg/os_utilities/os_platform.py +++ b/warg/os_utilities/os_platform.py @@ -67,5 +67,6 @@ def has_x_server() -> bool: :rtype: """ if is_nix(): - return os.environ["DISPLAY"] != "" + return "DISPLAY" in os.environ and os.environ["DISPLAY"] != "" + return True