AveyTense Glossary

This page describes various definitions used in the AveyTense documentation. See also Python glossary.
abroad object
Object springing from abroad() function. It is actually an iterable object of internal class AbroadInitializer. To inspect abroad objects, since 0.3.50 there is a class method ~.Tense.isAbroad(). $k[from] $m[aveytense] $k[import] $t[Tense], $a[d] $t[Tense].$tm[isAbroad]($a[d]($n[12])) # True

Before 0.3.50, there was need getting the AbroadInitializer class reference via the type constructor:

$k[from] $m[aveytense] $k[import] $a[d] $f[isinstance]($a[d]($n[12]), $c[type]($a[d]($n[1]))) # True

Constructor of class AbroadInitializer is mysterious, and doesn't require at least one parameter, just as abroad() function: it demands all 4 from 4 parameters to have a value. First of them is a sequence, last three are corresponding values as in abroad() function, those are value1, value2 and modifier.

__all__
This attribute can be accessed from many modules and classes, and it returns all non-underscored members of a module or a class. For example, aveytense.__all__ returns all globally scoped functions and classes inside module aveytense, meanwhile aveytense.Tense.__all__ returns all normally accessible non-underscored members of the class aveytense.Tense. Since 0.3.53, aveytense.util features a decorator @all for creating the __all__ attribute for types easier.

$k[from] $m[aveytense] $k[import] $msu[util] $o[@]$msu[util].$f[all]() $k[class] $c[Test]:   $v[c1] $o[=] $n[87]   $v[c1] $o[=] $n[72] $f[print]($c[Test].$v[__all__]) # ['c1', 'c2']

Parentheses after @all cannot be missed, otherwise an error is thrown (surprisingly it is AttributeError stating that there is lack of attribute we created). Moreover, there are 4 optional parameters. However, these won't be discussed as this goes beyond the definition of the __all__ attribute.

AveyTense 0.3.41 meant to provide 2 definitions in aveytense.util specially for making the __all__ attribute easier: class decorator @All and decorator @all. These got marked unrealized, because mechanisms used didn't work. Ultimately, on 0.3.53, @all has been defined.
AVT_ prefixed types

≥ 0.3.52

Types with AVT_ prefix from submodule aveytense.types are supposed to warrant their current state for all supported versions of Python by AveyTense (≥ 3.8). Naming syntax is:

$k[AVT_]<typeName> # first letter is uppercased, then rest is CamelCase'd

AVT types are split into 3 categories:

List of AVT_ prefixed types:

Type name Lifetime Python equivalent
Primal
aveytense.types.AVT_Array ≥ 0.3.54 array.array (1)
aveytense.types.AVT_AsyncContextManager ≥ 0.3.53 contextlib.AbstractAsyncContextManager (2) (3)
aveytense.types.AVT_AsyncGenerator ≥ 0.3.52 collections.abc.AsyncGenerator (2)
aveytense.types.AVT_AsyncIterable ≥ 0.3.52 collections.abc.AsyncIterable (2)
aveytense.types.AVT_AsyncIterator ≥ 0.3.52 collections.abc.AsyncIterator (2)
aveytense.types.AVT_Awaitable ≥ 0.3.52 collections.abc.Awaitable (2)
aveytense.types.AVT_Callable ≥ 0.3.52 collections.abc.Callable (2)
aveytense.types.AVT_ChainMap ≥ 0.3.52 collections.ChainMap (2)
aveytense.types.AVT_Collection ≥ 0.3.52 collections.abc.Collection (2)
aveytense.types.AVT_Container ≥ 0.3.52 collections.abc.Container (2)
aveytense.types.AVT_ContextManager ≥ 0.3.53 contextlib.AbstractContextManager (2) (3)
aveytense.types.AVT_Coroutine ≥ 0.3.52 collections.abc.Coroutine (2)
aveytense.types.AVT_Counter ≥ 0.3.52 collections.Counter (2)
aveytense.types.AVT_DefaultDict ≥ 0.3.52 collections.defaultdict (2)
aveytense.types.AVT_Deque ≥ 0.3.52 collections.deque (2)
aveytense.types.AVT_Dict ≥ 0.3.52 dict (2)
aveytense.types.AVT_Enumerate ≥ 0.3.55a2 enumerate (4)
aveytense.types.AVT_FrozenSet ≥ 0.3.52 frozenset (2)
aveytense.types.AVT_Generator ≥ 0.3.52 collections.abc.Generator (2)
aveytense.types.AVT_ItemsView ≥ 0.3.52 collections.abc.ItemsView (2)
aveytense.types.AVT_Iterable ≥ 0.3.52 collections.abc.Iterable (2)
aveytense.types.AVT_Iterator ≥ 0.3.52 collections.abc.Iterator (2)
aveytense.types.AVT_KeysView ≥ 0.3.52 collections.abc.KeysView (2)
aveytense.types.AVT_List ≥ 0.3.52 list (2)
aveytense.types.AVT_Mapping ≥ 0.3.52 collections.abc.Mapping (2)
aveytense.types.AVT_MappingView ≥ 0.3.52 collections.abc.MappingView (2)
aveytense.types.AVT_Match ≥ 0.3.52 re.Match (2)
aveytense.types.AVT_MemoryView ≥ 0.3.54 memoryview (5)
aveytense.types.AVT_MutableMapping ≥ 0.3.52 collections.abc.MutableMapping (2)
aveytense.types.AVT_MutableSequence ≥ 0.3.52 collections.abc.MutableSequence (2)
aveytense.types.AVT_MutableUniqual ≥ 0.3.52 collections.abc.MutableSet (2) (6)
aveytense.types.AVT_OrderedDict ≥ 0.3.52 collections.OrderedDict (2)
aveytense.types.AVT_PathLike ≥ 0.3.54 os.PathLike (7)
aveytense.types.AVT_Pattern ≥ 0.3.52 re.Pattern (2)
aveytense.types.AVT_Reversible ≥ 0.3.52 collections.abc.Reversible (2)
aveytense.types.AVT_Sequence ≥ 0.3.52 collections.abc.Sequence (2)
aveytense.types.AVT_Set ≥ 0.3.52 set (2)
aveytense.types.AVT_Tuple ≥ 0.3.52 tuple (2)
aveytense.types.AVT_Type ≥ 0.3.52 type (2)
aveytense.types.AVT_Uniqual ≥ 0.3.52 collections.abc.Set (2) (6)
aveytense.types.AVT_ValuesView ≥ 0.3.52 collections.abc.ValuesView (2)
Secondary
aveytense.types.AVT_Accumulate ≥ 0.3.55a2 itertools.accumulate
aveytense.types.AVT_Batched ≥ 0.3.55a2 itertools.batched (8)
aveytense.types.AVT_Chain ≥ 0.3.55a2 itertools.chain
aveytense.types.AVT_Combinations ≥ 0.3.55a2 itertools.combinations
aveytense.types.AVT_CombinationsReplacement ≥ 0.3.55a2 itertools.combinations_with_replacement
aveytense.types.AVT_Compress ≥ 0.3.55a2 itertools.compress
aveytense.types.AVT_Count ≥ 0.3.55a2 itertools.count
aveytense.types.AVT_Cycle ≥ 0.3.55a2 itertools.cycle
aveytense.types.AVT_DropWhile ≥ 0.3.55a2 itertools.dropwhile
aveytense.types.AVT_FilterFalse ≥ 0.3.55a2 itertools.filterfalse
aveytense.types.AVT_GroupBy ≥ 0.3.55a2 itertools.groupby
aveytense.types.AVT_Islice ≥ 0.3.55a2 itertools.islice
aveytense.types.AVT_Pairwise ≥ 0.3.55a2 itertools.pairwise (9)
aveytense.types.AVT_Permutations ≥ 0.3.55a2 itertools.permutations
aveytense.types.AVT_Product ≥ 0.3.55a2 itertools.product
aveytense.types.AVT_Repeat ≥ 0.3.55a2 itertools.repeat
aveytense.types.AVT_StarMap ≥ 0.3.55a2 itertools.starmap
aveytense.types.AVT_TakeWhile ≥ 0.3.55a2 itertools.takewhile
aveytense.types.AVT_Zip ≥ 0.3.55a2 zip
aveytense.types.AVT_ZipLongest ≥ 0.3.55a2 itertools.zip_longest
Clean
aveytense.types.AVT_GenericAlias ≥ 0.3.55a2 types.GenericAlias
aveytense.types.AVT_UnionType ≥ 0.3.55a2 types.UnionType

(1) array.array is subscriptable since Python 3.12; in this case AVT_Array for Python 3.12 and above is clean type alias of array.array. For least versions it occurs as a class inheriting from array.array and typing.Generic.

(2) All these classes are generic since Python 3.9; in previous versions of Python their generic equivalents were stored in the typing library. Today these still exist despite these are deprecated, as in this article, as no version of removal was given to this day. Before Python 3.9, these classes are imported from typing library, since and after - from their Python libraries, without any modifications performed in either version.

(3) Following naming of ABCs from contextlib library in typing library, there is no Abstract prefix.

(4) enumerate is subscriptable since Python 3.9, but its version on typing module (Enumerate) wasn't defined.

(5) memoryview is subscriptable since Python 3.14; in this case AVT_MemoryView for Python 3.14 and above is clean type alias of memoryview. For least versions it occurs as an inheritable class (exception from memoryview) with base typing.Generic and that re-implements every memoryview class member. It would be much easier, if memoryview wasn't a final class.

(6) To not collide with 2 classes having name Set (collections.abc.Set and typing.Set) that also have different use, for AveyTense collections.abc.Set is called Uniqual, and collections.abc.MutableSet has name MutableUniqual. typing.Set remains as-is, and it is the class referred by AVT_Set for Python 3.8.

(7) os.PathLike is subscriptable since Python 3.9, so for Python 3.8 it is defined as a generic protocol class (as it is not defined in typing). Since Python 3.9, AVT_PathLike is clean type alias of os.PathLike.

(8) itertools.batched is backported before Python 3.13 (itertools.batched was actually added in 3.12, but it was lacking the strict keyword parameter). Implementation is different as shown in the documentation.

(9) itertools.pairwise is backported before Python 3.10

Using example (supported versions of Python by AveyTense):

# from __future__ import annotations $k[from] $m[aveytense].$msu[types] $k[import] $o[*] $k[from] $m[typing] $k[import] $c[List] $k[def] $f[f]($p[i]: $c[l]$c[ist][$c[int]]): $o[...] # ≥ 3.9 $k[def] $f[f]($p[i]: $c[List][$c[int]]): $o[...] # 3.8 $k[def] $f[f]($p[i]: $c[AVT_List][$c[int]]): $o[...] # ≥ 3.8

To inspect types with subscripted type(s), consider following:

# from __future__ import annotations $k[from] $m[aveytense].$msu[types] $k[import] $o[*] $f[isinstance]($c[AVT_List][$c[int]], $c[TypingGenericType]) # ≥ 3.9 = False, 3.8 = True $f[isinstance]($c[AVT_List][$c[int]], $c[GenericAlias]) # ≥ 3.9 = True, 3.8 = not defined

mode parameter
The mode parameter appears in class methods of class aveytense.Tense usually starting with is- prefix, and it is used to modify the checking technique. By default it usually has value ~.constants.MODE_AND, indicating every object must comply specific requirement. Same can be achieved with value "and". Meanwhile values ~.constants.MODE_OR and "or" allow to alleviate the value checking - at least one of the objects has to complete the given condition. One of examples is given in class method ~.Tense.hasattr().

Examples of class methods in class aveytense.Tense having the mode parameter: ~.Tense.isEllipsis(), ~.Tense.isInteger(), ~.Tense.isNone(), ~.Tense.isString(). This parameter has been defined on large scale in version 0.3.36, but ~.Tense.hasattr() has it since 0.3.34.
paired functions
This kind of functions receive updates in the same period. Examples: ~.Tense.append() & ~.Tense.extend() and ~.Tense.reverse() & ~.Tense.shuffle()
pre-PEP 570 positional parameters
Kind of positional parameters before PEP 570. To create positional parameters before PEP 570 was accepted in Python 3.8, it was required to use 2 underscores before parameter names, and on the parameter section beginning only. $k[def] $f[f]($p[__p1], $p[__p2], $p[__p3] $o[=] $n[84]): $o[...] Last built-in function in Python, which used this notation, was range. Perhaps you can actually pass a value with keyword, what makes this type of parameters universal, code actually nudges that these parameters require a parameter passed via position. It is also worth noticing some libraries and applications use this naming convention as in this section, including Visual Studio Code. Pre-PEP 570 positional parameters are included in final properties in class ~.util.ParamVar starting with the word positional. If there is need to mark these positional parameters as universal, consider following solution: $k[from] $m[aveytense] $k[import] $o[*] $f[def] $f[f]($p[__p1], $p[__p2], $p[__p3]): $o[...] $v[p] $o[=] $msu[util].$cut[ParamVar]($f[f]) $t[Tense].$tm[print]($v[p].$fp[positional] $o[+] $v[p].$fp[universal])
pure functions
This kind of functions return internally modified version of one or more parameter values usually by copying the values to internal variables, however, without modifying parameter values passed. Examples of pure functions: ~.Tense.append(), ~.Tense.extend(), ~.Tense.reverse(), ~.Tense.shuffle(). Consider the following invocation: $k[from] $m[random] $k[import] $f[shuffle] $v[a] $o[=] [$n[72], $n[83], $n[36], $n[48]] $f[shuffle]($v[a]) $t[Tense].$tm[print]($v[a]) # [48, 72, 83, 36] If random.shuffle() modified the list instance (there a), that means this function isn't pure. Meanwhile with ~.Tense.shuffle() returned is reversed copy of the sequence: $k[from] $m[aveytense] $k[import] $t[Tense] $v[a] $o[=] [$n[72], $n[83], $n[36], $n[48]] $v[b] $o[=] $t[Tense].$tm[shuffle]($v[a]) $t[Tense].$tm[print]($v[a], $v[b]) # [72, 83, 36, 48], [48, 72, 83, 36] Thereupon ~.Tense.shuffle() class method is pure, because it returns modified version of the target sequence.
sequence items type checking functions
This kind of functions are looking not only for specific sequence type, such as list with ~.Tense.isList() class method or set with ~.Tense.isSet(), but also types of all items within the sequence. This is what additional parameter type is for. Some IDEs can type hint a sequence, just like below:

$v[a] $o[=] [$n[32]] $o[+] [$s[64]] # list[int | str]

However, we cannot really deduce types from all sequence items using typing.get_args() with type(a) as this function's value. That means we will have to iterate through all items in the sequence.

$t[Tense].$tm[print]([$c[type]($v[e]) $k[for] $v[e] $k[in] $v[a]]) # [<class 'int'>, <class 'str'>]

This technique is used with the type parameter. For example (order of types there doesn't matter):

$k[from] $m[aveytense] $k[import] $o[*] $t[Tense].$tm[print]($t[Tense].$tm[isList]($v[a], ($c[int], $c[str]))) # True

Concept with [type(e) for e in <sequence>] promotes defined in version 0.3.51 class method ~.Tense.getAllItemsTypes(). If some types repeat, they won't be added to the returned unique tuple (see ~.util.uniquetuple).
tilde (~)
Documentation-exclusive; refers to aveytense module mostly; also used to keep accordance with tense before 0.3.40. If ~ is used in a class or module documentation, then it can point to that class/module.
universal parameter
This kind of parameter can be passed either via position or keyword. Placement isn't hard to recognize. def f( [(...POSITIONAL_PARAMS, /)|(...PRE_PEP_570_POSITIONAL_PARAMS)], [...UNIVERSAL_PARAMS], [*[VARIABLE_ARG]], [...KEYWORD_PARAMS], [**VARIABLE_KWARG] ): Word universal is used in final properties in class ~.util.ParamVar as their prefix.
Site created by Aveyzan on 31st July 2022