Skip to content

Commit

Permalink
test 'DISPLAY' containment first
Browse files Browse the repository at this point in the history
  • Loading branch information
cnheider committed Apr 20, 2023
1 parent 3738df7 commit 12c6195
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 10 deletions.
2 changes: 1 addition & 1 deletion warg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion warg/ast_ops/first_arg_identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion warg/config_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down
18 changes: 15 additions & 3 deletions warg/decorators/kw_passing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down Expand Up @@ -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:
"""
Expand Down
12 changes: 11 additions & 1 deletion warg/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion warg/generators/filtering.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
11 changes: 10 additions & 1 deletion warg/math_utilities/ordinals.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))
3 changes: 2 additions & 1 deletion warg/os_utilities/os_platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 12c6195

Please sign in to comment.