pyTooling.GenericPath.URL

Classes

  • Protocols: Enumeration of supported URL schemes.

  • Host: Represents a hostname (including the port number) in a URL.

  • Element: Derived class for the URL context.

  • Path: Represents a path in a URL.

  • URL: Represents a URL including scheme, host, credentials, path, query and fragment.


Classes

class pyTooling.GenericPath.URL.Protocols(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Enumeration of supported URL schemes.

Inheritance

Inheritance diagram of Protocols

TLS = 1

Transport Layer Security

HTTP = 2

Hyper Text Transfer Protocol

HTTPS = 4

SSL/TLS secured HTTP

FTP = 8

File Transfer Protocol

FTPS = 16

SSL/TLS secured FTP

FILE = 32

Local files

static _generate_next_value_(name, start, count, last_values)

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_values: the last value assigned or None

__format__(format_spec, /)

Convert to a string according to format_spec.

__str__()

Return repr(self).

__repr__()

Return repr(self).

__or__(other)

Return self|value.

__and__(other)

Return self&value.

__xor__(other)

Return self^value.

__ror__(other)

Return value|self.

__rand__(other)

Return value&self.

__rxor__(other)

Return value^self.

__invert__()

~self

__new__(value)
__hash__()

Return hash(self).

__getattribute__(name, /)

Return getattr(self, name).

__lt__(value, /)

Return self<value.

__le__(value, /)

Return self<=value.

__eq__(value, /)

Return self==value.

__ne__(value, /)

Return self!=value.

__gt__(value, /)

Return self>value.

__ge__(value, /)

Return self>=value.

__add__(value, /)

Return self+value.

__radd__(value, /)

Return value+self.

__sub__(value, /)

Return self-value.

__rsub__(value, /)

Return value-self.

__mul__(value, /)

Return self*value.

__rmul__(value, /)

Return value*self.

__mod__(value, /)

Return self%value.

__rmod__(value, /)

Return value%self.

__divmod__(value, /)

Return divmod(self, value).

__rdivmod__(value, /)

Return divmod(value, self).

__pow__(value, mod=None, /)

Return pow(self, value, mod).

__rpow__(value, mod=None, /)

Return pow(value, self, mod).

__neg__()

-self

__pos__()

+self

__abs__()

abs(self)

__bool__()

True if self else False

__lshift__(value, /)

Return self<<value.

__rlshift__(value, /)

Return value<<self.

__rshift__(value, /)

Return self>>value.

__rrshift__(value, /)

Return value>>self.

__int__()

int(self)

__float__()

float(self)

__floordiv__(value, /)

Return self//value.

__rfloordiv__(value, /)

Return value//self.

__truediv__(value, /)

Return self/value.

__rtruediv__(value, /)

Return value/self.

__index__()

Return self converted to an integer, if self is suitable for use as an index into a list.

conjugate()

Returns self, the complex conjugate of any int.

bit_length()

Number of bits necessary to represent self in binary.

>>> bin(37)
'0b100101'
>>> (37).bit_length()
6
bit_count()

Number of ones in the binary representation of the absolute value of self.

Also known as the population count.

>>> bin(13)
'0b1101'
>>> (13).bit_count()
3
to_bytes(length=1, byteorder='big', *, signed=False)

Return an array of bytes representing an integer.

length

Length of bytes object to use. An OverflowError is raised if the integer is not representable with the given number of bytes. Default is length 1.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Determines whether two’s complement is used to represent the integer. If signed is False and a negative integer is given, an OverflowError is raised.

from_bytes(byteorder='big', *, signed=False)

Return the integer represented by the given array of bytes.

bytes

Holds the array of bytes to convert. The argument must either support the buffer protocol or be an iterable object producing bytes. Bytes and bytearray are examples of built-in objects that support the buffer protocol.

byteorder

The byte order used to represent the integer. If byteorder is ‘big’, the most significant byte is at the beginning of the byte array. If byteorder is ‘little’, the most significant byte is at the end of the byte array. To request the native byte order of the host system, use `sys.byteorder’ as the byte order value. Default is to use ‘big’.

signed

Indicates whether two’s complement is used to represent the integer.

as_integer_ratio()

Return a pair of integers, whose ratio is equal to the original int.

The ratio is in lowest terms and has a positive denominator.

>>> (10).as_integer_ratio()
(10, 1)
>>> (-10).as_integer_ratio()
(-10, 1)
>>> (0).as_integer_ratio()
(0, 1)
__trunc__()

Truncating an Integral returns itself.

__floor__()

Flooring an Integral returns itself.

__ceil__()

Ceiling of an Integral returns itself.

__round__()

Rounding an Integral returns itself.

Rounding with an ndigits argument also returns an integer.

__sizeof__()

Returns size in memory, in bytes.

is_integer()

Returns True. Exists for duck type compatibility with float.is_integer.

real

the real part of a complex number

imag

the imaginary part of a complex number

numerator

the numerator of a rational number in lowest terms

denominator

the denominator of a rational number in lowest terms

_numeric_repr_()

Return the canonical string representation of the object.

For many object types, including most builtins, eval(repr(obj)) == obj.

classmethod _iter_member_by_value_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_(value)

Extract all members from the value in definition (i.e. increasing value) order.

classmethod _iter_member_by_def_(value)

Extract all members from the value in definition order.

classmethod _missing_(value)

Create a composite member containing all canonical members present in value.

If non-member values are present, result depends on _boundary_ setting.

__contains__(other)

Returns True if self has at least the same flags set as other.

__iter__()

Returns flags in definition order.

__len__()

Return the number of members (no aliases)

__dir__()

Returns public methods and other interesting attributes.

__init__(*args, **kwds)
__reduce_ex__(proto)

Helper for pickle.

class pyTooling.GenericPath.URL.Host(hostname, port=None)[source]

Represents a hostname (including the port number) in a URL.

Inheritance

Inheritance diagram of Host

Parameters:
  • hostname (str)

  • port (int | None)

__init__(hostname, port=None)[source]
Parameters:
  • hostname (str)

  • port (int | None)

Return type:

None

property Hostname: str

Hostname or IP address as string.

property Port: int | None

Port number as integer.

__str__()[source]

Return str(self).

Return type:

str

class pyTooling.GenericPath.URL.Element(parent, elementName)[source]

Derived class for the URL context.

Inheritance

Inheritance diagram of Element

Parameters:
__init__(parent, elementName)
Parameters:
Return type:

None

__str__()

Return str(self).

Return type:

str

class pyTooling.GenericPath.URL.Path(elements, isAbsolute)[source]

Represents a path in a URL.

Inheritance

Inheritance diagram of Path

Parameters:
ELEMENT_DELIMITER = '/'

Delimiter symbol in URLs between path elements.

ROOT_DELIMITER = '/'

Delimiter symbol in URLs between root element and first path element.

classmethod Parse(path, root=None)[source]

Parses a string representation of a path and returns a path instance.

Return type:

Path

Parameters:
__init__(elements, isAbsolute)
Parameters:
Return type:

None

__len__()

Returns the number of path elements.

Return type:

int

Returns:

Number of path elements.

__str__()

Return str(self).

Return type:

str

class pyTooling.GenericPath.URL.URL(scheme, path, host=None, user=None, password=None, query=None, fragment=None)[source]

Represents a URL including scheme, host, credentials, path, query and fragment.

Inheritance

Inheritance diagram of URL

Parameters:
__init__(scheme, path, host=None, user=None, password=None, query=None, fragment=None)[source]
Parameters:
Return type:

None

__str__()[source]

Return str(self).

Return type:

str