index
int64
0
731k
package
stringlengths
2
98
name
stringlengths
1
76
docstring
stringlengths
0
281k
code
stringlengths
4
1.07M
signature
stringlengths
2
42.8k
5,710
simple_di
_ProvideClass
used as the default value of a injected functool/method. Would be replaced by the final value of the provider when this function/method gets called.
class _ProvideClass: """ used as the default value of a injected functool/method. Would be replaced by the final value of the provider when this function/method gets called. """ def __getitem__(self, provider: Provider[VT]) -> VT: return provider # type: ignore
()
5,711
simple_di
__getitem__
null
def __getitem__(self, provider: Provider[VT]) -> VT: return provider # type: ignore
(self, provider: simple_di.Provider[~VT]) -> ~VT
5,712
simple_di
_SentinelClass
null
class _SentinelClass: pass
()
5,713
simple_di
_inject
null
def _inject(func: WrappedCallable, squeeze_none: bool) -> WrappedCallable: if getattr(func, "_is_injected", False): return func sig = inspect.signature(func) @functools.wraps(func) def _( *args: Optional[Union[Any, _SentinelClass]], **kwargs: Optional[Union[Any, _SentinelClass]...
(func: ~WrappedCallable, squeeze_none: bool) -> ~WrappedCallable
5,714
simple_di
_inject_args
null
def _inject_args( args: Tuple[Union[Provider[VT], Any], ...] ) -> Tuple[Union[VT, Any], ...]: return tuple(a.get() if isinstance(a, Provider) else a for a in args)
(args: Tuple[Union[simple_di.Provider[~VT], Any], ...]) -> Tuple[Union[~VT, Any], ...]
5,715
simple_di
_inject_kwargs
null
def _inject_kwargs( kwargs: Dict[str, Union[Provider[VT], Any]] ) -> Dict[str, Union[VT, Any]]: return {k: v.get() if isinstance(v, Provider) else v for k, v in kwargs.items()}
(kwargs: Dict[str, Union[simple_di.Provider[~VT], Any]]) -> Dict[str, Union[~VT, Any]]
5,716
typing
cast
Cast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don't check anything (we want this to be as fast as possible).
def cast(typ, val): """Cast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don't check anything (we want this to be as fast as possible). """ return val
(typ, val)
5,717
dataclasses
dataclass
Returns the same class as was passed in, with dunder methods added based on the fields defined in the class. Examines PEP 526 __annotations__ to determine fields. If init is true, an __init__() method is added to the class. If repr is true, a __repr__() method is added. If order is true, rich comp...
def dataclass(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False): """Returns the same class as was passed in, with dunder methods added based on the fields defined in the class. Examines PEP 5...
(cls=None, /, *, init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False, match_args=True, kw_only=False, slots=False)
5,721
simple_di
inject
used with `Provide`, inject values to provided defaults of the decorated function/method when gets called.
def inject( func: Optional[WrappedCallable] = None, squeeze_none: bool = False ) -> Union[WrappedCallable, Callable[[WrappedCallable], WrappedCallable]]: """ used with `Provide`, inject values to provided defaults of the decorated function/method when gets called. """ if func is None: wr...
(func: Optional[~WrappedCallable] = None, squeeze_none: bool = False) -> Union[~WrappedCallable, Callable[[~WrappedCallable], ~WrappedCallable]]
5,723
typing
overload
Decorator for overloaded functions/methods. In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload ...
def overload(func): """Decorator for overloaded functions/methods. In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes:...
(func)
5,724
simple_di
sync_container
sync container states from `from_` to `to_`
def sync_container(from_: Any, to_: Any) -> None: """ sync container states from `from_` to `to_` """ for field in dataclasses.fields(to_): src = field.default target = getattr(from_, field.name, None) if target is None: continue if isinstance(src, Provider): ...
(from_: Any, to_: Any) -> NoneType
5,725
logging
NullHandler
This handler does nothing. It's intended to be used to avoid the "No handlers could be found for logger XXX" one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off warning might be produced; to avoi...
class NullHandler(Handler): """ This handler does nothing. It's intended to be used to avoid the "No handlers could be found for logger XXX" one-off warning. This is important for library code, which may contain code to log events. If a user of the library does not configure logging, the one-off war...
(level=0)
5,726
logging
__init__
Initializes the instance - basically setting the formatter to None and the filter list to empty.
def __init__(self, level=NOTSET): """ Initializes the instance - basically setting the formatter to None and the filter list to empty. """ Filterer.__init__(self) self._name = None self.level = _checkLevel(level) self.formatter = None self._closed = False # Add the handler to the...
(self, level=0)
5,727
logging
__repr__
null
def __repr__(self): level = getLevelName(self.level) return '<%s (%s)>' % (self.__class__.__name__, level)
(self)
5,728
logging
_at_fork_reinit
null
def _at_fork_reinit(self): pass
(self)
5,729
logging
acquire
Acquire the I/O thread lock.
def acquire(self): """ Acquire the I/O thread lock. """ if self.lock: self.lock.acquire()
(self)
5,730
logging
addFilter
Add the specified filter to this handler.
def addFilter(self, filter): """ Add the specified filter to this handler. """ if not (filter in self.filters): self.filters.append(filter)
(self, filter)
5,731
logging
close
Tidy up any resources used by the handler. This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.
def close(self): """ Tidy up any resources used by the handler. This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods. """ #get the module data...
(self)
5,732
logging
createLock
null
def createLock(self): self.lock = None
(self)
5,733
logging
emit
Stub.
def emit(self, record): """Stub."""
(self, record)
5,734
logging
filter
Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. .. versionchanged:: 3.2 Allo...
def filter(self, record): """ Determine if a record is loggable by consulting all the filters. The default is to allow the record to be logged; any filter can veto this and the record is then dropped. Returns a zero value if a record is to be dropped, else non-zero. .. versionchanged:: 3.2 ...
(self, record)
5,735
logging
flush
Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses.
def flush(self): """ Ensure all logging output has been flushed. This version does nothing and is intended to be implemented by subclasses. """ pass
(self)
5,736
logging
format
Format the specified record. If a formatter is set, use it. Otherwise, use the default formatter for the module.
def format(self, record): """ Format the specified record. If a formatter is set, use it. Otherwise, use the default formatter for the module. """ if self.formatter: fmt = self.formatter else: fmt = _defaultFormatter return fmt.format(record)
(self, record)
5,737
logging
get_name
null
def get_name(self): return self._name
(self)
5,738
logging
handle
Stub.
def handle(self, record): """Stub."""
(self, record)
5,739
logging
handleError
Handle errors which occur during an emit() call. This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system - most users will...
def handleError(self, record): """ Handle errors which occur during an emit() call. This method should be called from handlers when an exception is encountered during an emit() call. If raiseExceptions is false, exceptions get silently ignored. This is what is mostly wanted for a logging system ...
(self, record)
5,740
logging
release
Release the I/O thread lock.
def release(self): """ Release the I/O thread lock. """ if self.lock: self.lock.release()
(self)
5,741
logging
removeFilter
Remove the specified filter from this handler.
def removeFilter(self, filter): """ Remove the specified filter from this handler. """ if filter in self.filters: self.filters.remove(filter)
(self, filter)
5,742
logging
setFormatter
Set the formatter for this handler.
def setFormatter(self, fmt): """ Set the formatter for this handler. """ self.formatter = fmt
(self, fmt)
5,743
logging
setLevel
Set the logging level of this handler. level must be an int or a str.
def setLevel(self, level): """ Set the logging level of this handler. level must be an int or a str. """ self.level = _checkLevel(level)
(self, level)
5,744
logging
set_name
null
def set_name(self, name): _acquireLock() try: if self._name in _handlers: del _handlers[self._name] self._name = name if name: _handlers[name] = self finally: _releaseLock()
(self, name)
5,758
simplefix.message
FixMessage
FIX protocol message. FIX messages consist of an ordered list of tag=value pairs. Tags are numbers, represented on the wire as strings. Values may have various types, again all presented as strings on the wire. This class stores a FIX message: it does not perform any validation of the content of...
class FixMessage: """FIX protocol message. FIX messages consist of an ordered list of tag=value pairs. Tags are numbers, represented on the wire as strings. Values may have various types, again all presented as strings on the wire. This class stores a FIX message: it does not perform any validat...
()
5,759
simplefix.message
__contains__
Directly support 'in' and 'not in' operators. :param item: Tag value to check.
def __contains__(self, item): """Directly support 'in' and 'not in' operators. :param item: Tag value to check. """ needle = fix_tag(item) for tag, _ in self.pairs: if tag == needle: return True return False
(self, item)
5,760
simplefix.message
__eq__
Compare with another FixMessage. :param other: Message to compare. Compares the tag=value pairs, message_type and FIX version of this message against the `other`.
def __eq__(self, other): """Compare with another FixMessage. :param other: Message to compare. Compares the tag=value pairs, message_type and FIX version of this message against the `other`. """ if not hasattr(other, "pairs"): return False # Check pairs list lengths. if len(self....
(self, other)
5,761
simplefix.message
__getitem__
Enable messages to be iterated over, and treated as a sequence. :param item_index: Numeric index in range 0 to length - 1 Supports both 'for tag, value in message' usage, and 'message[n]' access.
def __getitem__(self, item_index): """Enable messages to be iterated over, and treated as a sequence. :param item_index: Numeric index in range 0 to length - 1 Supports both 'for tag, value in message' usage, and 'message[n]' access. """ if item_index >= len(self.pairs): raise IndexError...
(self, item_index)
5,762
simplefix.message
__init__
Initialise a FIX message.
def __init__(self): """Initialise a FIX message.""" self.begin_string = None self.message_type = None self.pairs = [] self.header_index = 0
(self)
5,763
simplefix.message
__ne__
Inverse compare with another FixMessage. :param other: Message to compare. Compares the tag=value pairs, message_type and FIX version of this message against the `other`.
def __ne__(self, other): """Inverse compare with another FixMessage. :param other: Message to compare. Compares the tag=value pairs, message_type and FIX version of this message against the `other`. """ return not self == other
(self, other)
5,764
simplefix.message
__str__
Return string form of message contents.
def __str__(self): """Return string form of message contents.""" return self.to_string('|')
(self)
5,765
simplefix.message
_append_utc_datetime
(Internal) Append formatted datetime.
def _append_utc_datetime(self, tag, fmt, ts, precision, header): """(Internal) Append formatted datetime.""" if ts is None: t = datetime.datetime.utcnow() elif type(ts) is float: t = datetime.datetime.utcfromtimestamp(ts) else: t = ts if precision == 0: s = t.strftime...
(self, tag, fmt, ts, precision, header)
5,766
simplefix.message
_tz_offset_string
(Internal) Convert TZ offset in minutes east to string. :param offset: Offset in minutes east (-1439 to +1439).
@staticmethod def _tz_offset_string(offset): """(Internal) Convert TZ offset in minutes east to string. :param offset: Offset in minutes east (-1439 to +1439). """ io = int(offset) if io == 0: return 'Z' if io < -1439 or io > 1439: raise ValueError(f"Timezone `offset` ({io}) out ...
(offset)
5,767
simplefix.message
append_data
Append raw data, possibly including a embedded SOH. :param len_tag: Tag number for length field. :param val_tag: Tag number for value field. :param data: Raw data byte string. :param header: Append to header if True; default to body. Appends two pairs: a length pair, followed b...
def append_data(self, len_tag, val_tag, data, header=False): """Append raw data, possibly including a embedded SOH. :param len_tag: Tag number for length field. :param val_tag: Tag number for value field. :param data: Raw data byte string. :param header: Append to header if True; default to body. ...
(self, len_tag, val_tag, data, header=False)
5,768
simplefix.message
append_pair
Append a tag=value pair to this message. :param tag: Integer or string FIX tag number. :param value: FIX tag value. :param header: Append to header if True; default to body. Both parameters are explicitly converted to strings before storage, so it's ok to pass integers if that'...
def append_pair(self, tag, value, header=False): """Append a tag=value pair to this message. :param tag: Integer or string FIX tag number. :param value: FIX tag value. :param header: Append to header if True; default to body. Both parameters are explicitly converted to strings before storage, so...
(self, tag, value, header=False)
5,769
simplefix.message
append_string
Append a tag=value pair in string format. :param field: String "tag=value" to be appended to this message. :param header: Append to header if True; default to body. The string is split at the first '=' character, and the resulting tag and value strings are appended to the message. ...
def append_string(self, field, header=False): """Append a tag=value pair in string format. :param field: String "tag=value" to be appended to this message. :param header: Append to header if True; default to body. The string is split at the first '=' character, and the resulting tag and value string...
(self, field, header=False)
5,770
simplefix.message
append_strings
Append tag=pairs for each supplied string. :param string_list: List of "tag=value" strings. :param header: Append to header if True; default to body. Each string is split, and the resulting tag and value strings are appended to the message.
def append_strings(self, string_list, header=False): """Append tag=pairs for each supplied string. :param string_list: List of "tag=value" strings. :param header: Append to header if True; default to body. Each string is split, and the resulting tag and value strings are appended to the message. ...
(self, string_list, header=False)
5,771
simplefix.message
append_time
Append a time field to this message. :param tag: Integer or string FIX tag number. :param timestamp: Time (see below) value to append, or None for now. :param precision: Number of decimal digits. Zero for seconds only, three for milliseconds, 6 for microseconds. Defaults to millisecon...
def append_time(self, tag, timestamp=None, precision=3, utc=True, header=False): """Append a time field to this message. :param tag: Integer or string FIX tag number. :param timestamp: Time (see below) value to append, or None for now. :param precision: Number of decimal digits. Zero fo...
(self, tag, timestamp=None, precision=3, utc=True, header=False)
5,772
simplefix.message
append_tz_time_only
Append a field with a TZTimeOnly value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). :param header: Append to FIX header if True; default to body. The `timestamp` value sh...
def append_tz_time_only(self, tag, timestamp=None, precision=3, header=False): """Append a field with a TZTimeOnly value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). :p...
(self, tag, timestamp=None, precision=3, header=False)
5,773
simplefix.message
append_tz_time_only_parts
Append a field with a TZTimeOnly value from components. :param tag: Integer or string FIX tag number. :param h: Hours, in range 0 to 23. :param m: Minutes, in range 0 to 59. :param s: Optional seconds, in range 0 to 59 (60 for leap second). :param ms: Optional milliseconds, in r...
def append_tz_time_only_parts(self, tag, h, m, s=None, ms=None, us=None, offset=0, header=False): """Append a field with a TZTimeOnly value from components. :param tag: Integer or string FIX tag number. :param h: Hours, in range 0 to 23. :param m: Minutes, in range 0 to 59....
(self, tag, h, m, s=None, ms=None, us=None, offset=0, header=False)
5,774
simplefix.message
append_tz_timestamp
Append a field with a TZTimestamp value, derived from local time. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). :param header: Append to FIX header if True; default to body. ...
def append_tz_timestamp(self, tag, timestamp=None, precision=3, header=False): """Append a field with a TZTimestamp value, derived from local time. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0...
(self, tag, timestamp=None, precision=3, header=False)
5,775
simplefix.message
append_utc_time_only
Append a field with a UTCTimeOnly value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). :param header: Append to FIX header if True; default to body. The `timestamp` value s...
def append_utc_time_only(self, tag, timestamp=None, precision=3, header=False): """Append a field with a UTCTimeOnly value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). ...
(self, tag, timestamp=None, precision=3, header=False)
5,776
simplefix.message
append_utc_time_only_parts
Append a field with a UTCTimeOnly value from components. :param tag: Integer or string FIX tag number. :param h: Hours, in range 0 to 23. :param m: Minutes, in range 0 to 59. :param s: Seconds, in range 0 to 59 (60 for leap second). :param ms: Optional milliseconds, in range 0 t...
def append_utc_time_only_parts(self, tag, h, m, s, ms=None, us=None, header=False): """Append a field with a UTCTimeOnly value from components. :param tag: Integer or string FIX tag number. :param h: Hours, in range 0 to 23. :param m: Minutes, in range 0 to 59. :param ...
(self, tag, h, m, s, ms=None, us=None, header=False)
5,777
simplefix.message
append_utc_timestamp
Append a field with a UTCTimestamp value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). :param header: Append to FIX header if True; default to body. The `timestamp` value ...
def append_utc_timestamp(self, tag, timestamp=None, precision=3, header=False): """Append a field with a UTCTimestamp value. :param tag: Integer or string FIX tag number. :param timestamp: Time value, see below. :param precision: Number of decimal places: 0, 3 (ms) or 6 (us). ...
(self, tag, timestamp=None, precision=3, header=False)
5,778
simplefix.message
count
Return the number of pairs in this message.
def count(self): """Return the number of pairs in this message.""" return len(self.pairs)
(self)
5,779
simplefix.message
encode
Convert message to on-the-wire FIX format. :param raw: If True, encode pairs exactly as provided. Unless 'raw' is set, this function will calculate and correctly set the BodyLength (9) and Checksum (10) fields, and ensure that the BeginString (8), Body Length (9), Message Type ...
def encode(self, raw=False): """Convert message to on-the-wire FIX format. :param raw: If True, encode pairs exactly as provided. Unless 'raw' is set, this function will calculate and correctly set the BodyLength (9) and Checksum (10) fields, and ensure that the BeginString (8), Body Length (9), Mes...
(self, raw=False)
5,780
simplefix.message
get
Return n-th value for tag. :param tag: FIX field tag number. :param nth: Index of tag if repeating, first is 1. :return: None if nothing found, otherwise value matching tag. Defaults to returning the first matching value of 'tag', but if the 'nth' parameter is overridden, can g...
def get(self, tag, nth=1): """Return n-th value for tag. :param tag: FIX field tag number. :param nth: Index of tag if repeating, first is 1. :return: None if nothing found, otherwise value matching tag. Defaults to returning the first matching value of 'tag', but if the 'nth' parameter is overr...
(self, tag, nth=1)
5,781
simplefix.message
remove
Remove the n-th occurrence of tag in this message. :param tag: FIX field tag number to be removed. :param nth: Index of tag if repeating, first is 1. :returns: Value of the field if removed, None otherwise.
def remove(self, tag, nth=1): """Remove the n-th occurrence of tag in this message. :param tag: FIX field tag number to be removed. :param nth: Index of tag if repeating, first is 1. :returns: Value of the field if removed, None otherwise. """ tag = fix_tag(tag) nth = int(nth) for i in r...
(self, tag, nth=1)
5,782
simplefix.message
to_string
Return string form of message. :param separator: Field separator, defaults to '|'. :returns: String representation of this FIX message. Note that the output from this function is NOT a legal FIX message (see encode() for that): this is for logging or other human-oriented consum...
def to_string(self, separator: str = '|') -> str: """Return string form of message. :param separator: Field separator, defaults to '|'. :returns: String representation of this FIX message. Note that the output from this function is NOT a legal FIX message (see encode() for that): this is for logging...
(self, separator: str = '|') -> str
5,783
simplefix.parser
FixParser
FIX protocol message parser. This class translates FIX application messages in raw (wire) format into instance of the FixMessage class. It does not perform any validation of the fields, their presence or absence in a particular message, the data types of fields, or the values of enumerations. ...
class FixParser: """FIX protocol message parser. This class translates FIX application messages in raw (wire) format into instance of the FixMessage class. It does not perform any validation of the fields, their presence or absence in a particular message, the data types of fields, or the valu...
(allow_empty_values: bool = False, allow_missing_begin_string: bool = False, strip_fields_before_begin_string: bool = True, stop_tag: int = 10, stop_byte: Optional[bytes] = None)
5,784
simplefix.parser
__init__
Constructor. :param allow_empty_values: If set, an empty field value is allowed, in violation of the FIX specification which prohibits this. :param allow_missing_begin_string: If set, an initial field other than BeginString (8) is permitted. :param strip_fields_before_be...
def __init__(self, allow_empty_values: bool = False, allow_missing_begin_string: bool = False, strip_fields_before_begin_string: bool = True, stop_tag: int = DEFAULT_STOP_TAG, stop_byte: Optional[bytes] = None): """Constructor. :param allow_empty_...
(self, allow_empty_values: bool = False, allow_missing_begin_string: bool = False, strip_fields_before_begin_string: bool = True, stop_tag: int = 10, stop_byte: Optional[bytes] = None)
5,785
simplefix.parser
add_raw
Define the tags used for a private raw data field. :param length_tag: tag number of length field. :param value_tag: tag number of value field. Data fields are not terminated by the SOH character as is usual for FIX, but instead have a second, preceding field that specifies the ...
def add_raw(self, length_tag, value_tag): """Define the tags used for a private raw data field. :param length_tag: tag number of length field. :param value_tag: tag number of value field. Data fields are not terminated by the SOH character as is usual for FIX, but instead have a second, preceding fi...
(self, length_tag, value_tag)
5,786
simplefix.parser
append_buffer
Append a byte string to the parser buffer. :param buf: byte string to append. The parser maintains an internal buffer of bytes to be parsed. As raw data is read, it can be appended to this buffer. Each call to get_message() will try to remove the bytes of a complete messages f...
def append_buffer(self, buf): """Append a byte string to the parser buffer. :param buf: byte string to append. The parser maintains an internal buffer of bytes to be parsed. As raw data is read, it can be appended to this buffer. Each call to get_message() will try to remove the bytes of a comp...
(self, buf)
5,787
simplefix.parser
get_buffer
Return a reference to the internal buffer.
def get_buffer(self): """Return a reference to the internal buffer.""" return self.buf
(self)
5,788
simplefix.parser
get_message
Process the accumulated buffer and return the first message. If the buffer starts with FIX fields other than BeginString (8), these are discarded until the start of a message is found. If no BeginString (8) field is found, this function returns None. Similarly, if (after a Beg...
def get_message(self): """Process the accumulated buffer and return the first message. If the buffer starts with FIX fields other than BeginString (8), these are discarded until the start of a message is found. If no BeginString (8) field is found, this function returns None. Similarly, if (aft...
(self)
5,789
simplefix.parser
remove_raw
Remove the tags for a data type field. :param length_tag: tag number of the length field. :param value_tag: tag number of the value field. You can remove either private or standard data field definitions in case a particular application uses them for a field of a different type...
def remove_raw(self, length_tag, value_tag): """Remove the tags for a data type field. :param length_tag: tag number of the length field. :param value_tag: tag number of the value field. You can remove either private or standard data field definitions in case a particular application uses them for a...
(self, length_tag, value_tag)
5,790
simplefix.parser
reset
Reset the internal parser state. This will discard any appended buffer content, and any fields parsed so far.
def reset(self): """Reset the internal parser state. This will discard any appended buffer content, and any fields parsed so far. """ self.buf = b"" self.pairs = [] self.raw_len = 0
(self)
5,791
simplefix.parser
set_allow_empty_values
Accept a zero-length value when parsing. :param value: If False, raise exception for zero-length values The FIX specification prohibits zero-length values, instead suggesting that the field be omitted from the message entirely. Some implementations do allow a zero-length value, and so ...
def set_allow_empty_values(self, value=True): """Accept a zero-length value when parsing. :param value: If False, raise exception for zero-length values The FIX specification prohibits zero-length values, instead suggesting that the field be omitted from the message entirely. Some implementations do...
(self, value=True)
5,792
simplefix.parser
set_allow_missing_begin_string
If set, the first field of a message must be BeginString (8). :param value: If True, check first field is begin. In some cases, especially FIX-encoded stored data, there might not be a Begin String (8) at the start of each message. Note this value cannot be True if strip_fields_before...
def set_allow_missing_begin_string(self, value=True): """If set, the first field of a message must be BeginString (8). :param value: If True, check first field is begin. In some cases, especially FIX-encoded stored data, there might not be a Begin String (8) at the start of each message. Note this v...
(self, value=True)
5,793
simplefix.parser
set_message_terminator
Set the end-of-message detection scheme. :param tag: FIX tag number of terminating field. Default is 10. :param char: Alternative, terminating character. THIS METHOD IS DEPRECATED. Use set_stop_tag(), set_stop_byte(), or constructor keywords instead. By default, messa...
def set_message_terminator(self, tag=None, char=None): """Set the end-of-message detection scheme. :param tag: FIX tag number of terminating field. Default is 10. :param char: Alternative, terminating character. THIS METHOD IS DEPRECATED. Use set_stop_tag(), set_stop_byte(), or constructor keywords...
(self, tag=None, char=None)
5,794
simplefix.parser
set_stop_byte
Set a byte value that will terminate a message. :param value: Byte (character) value, usually CR or LF. If the parser encounters this byte, anywhere in a message, it is interpreted as the end of that message. This is often used when multiple messages are recorded in a file, separated ...
def set_stop_byte(self, value: Optional[bytes] = None): """Set a byte value that will terminate a message. :param value: Byte (character) value, usually CR or LF. If the parser encounters this byte, anywhere in a message, it is interpreted as the end of that message. This is often used when multipl...
(self, value: Optional[bytes] = None)
5,795
simplefix.parser
set_stop_tag
Set the tag number of the final field in a message. :param value: Final field tag number. The default value here is CheckSum (10): the parser recognizes a 10=xxx field as the end of a message. Note that this value is overridden if a stop_byte is set.
def set_stop_tag(self, value: int = DEFAULT_STOP_TAG): """Set the tag number of the final field in a message. :param value: Final field tag number. The default value here is CheckSum (10): the parser recognizes a 10=xxx field as the end of a message. Note that this value is overridden if a stop_byt...
(self, value: int = 10)
5,796
simplefix.parser
set_strip_fields_before_begin_string
Choose whether to discard any fields parsed before 8=FIX. :param value: If set, discard any fields before the BeginString (8). Note that this setting cannot be set if a missing BeginString is also permitted.
def set_strip_fields_before_begin_string(self, value: bool = True): """Choose whether to discard any fields parsed before 8=FIX. :param value: If set, discard any fields before the BeginString (8). Note that this setting cannot be set if a missing BeginString is also permitted. """ self.strip_fi...
(self, value: bool = True)
5,802
simplefix
pretty_print
Pretty-print a raw FIX buffer. :param buf: Byte sequence containing raw message. :param sep: Separator character to use for output, default is '|'. :returns: Formatted byte array.
def pretty_print(buf, sep='|'): """Pretty-print a raw FIX buffer. :param buf: Byte sequence containing raw message. :param sep: Separator character to use for output, default is '|'. :returns: Formatted byte array.""" raw = bytearray(buf) cooked = bytearray(len(raw)) for i, value in enumer...
(buf, sep='|')
5,804
boto.storage_uri
BucketStorageUri
StorageUri subclass that handles bucket storage providers. Callers should instantiate this class by calling boto.storage_uri().
class BucketStorageUri(StorageUri): """ StorageUri subclass that handles bucket storage providers. Callers should instantiate this class by calling boto.storage_uri(). """ delim = '/' capabilities = set([]) # A set of additional capabilities. def __init__(self, scheme, bucket_name=None, o...
(scheme, bucket_name=None, object_name=None, debug=0, connection_args=None, suppress_consec_slashes=True, version_id=None, generation=None, is_latest=False)
5,805
boto.storage_uri
__init__
Instantiate a BucketStorageUri from scheme,bucket,object tuple. @type scheme: string @param scheme: URI scheme naming the storage provider (gs, s3, etc.) @type bucket_name: string @param bucket_name: bucket name @type object_name: string @param object_name: object name, ...
def __init__(self, scheme, bucket_name=None, object_name=None, debug=0, connection_args=None, suppress_consec_slashes=True, version_id=None, generation=None, is_latest=False): """Instantiate a BucketStorageUri from scheme,bucket,object tuple. @type scheme: string @param scheme: URI...
(self, scheme, bucket_name=None, object_name=None, debug=0, connection_args=None, suppress_consec_slashes=True, version_id=None, generation=None, is_latest=False)
5,806
boto.storage_uri
__repr__
Returns string representation of URI.
def __repr__(self): """Returns string representation of URI.""" return self.uri
(self)
5,807
boto.storage_uri
_build_uri_strings
null
def _build_uri_strings(self): if self.bucket_name and self.object_name: self.versionless_uri = '%s://%s/%s' % (self.scheme, self.bucket_name, self.object_name) if self.generation: self.version_specific_uri = '%s#%s' % (self.versionless_uri, ...
(self)
5,808
boto.storage_uri
_check_bucket_uri
null
def _check_bucket_uri(self, function_name): if issubclass(type(self), BucketStorageUri) and not self.bucket_name: raise InvalidUriError( '%s on bucket-less URI (%s)' % (function_name, self.uri))
(self, function_name)
5,809
boto.storage_uri
_check_object_uri
null
def _check_object_uri(self, function_name): if issubclass(type(self), BucketStorageUri) and not self.object_name: raise InvalidUriError('%s on object-less URI (%s)' % (function_name, self.uri))
(self, function_name)
5,810
boto.storage_uri
_update_from_key
null
def _update_from_key(self, key): self._update_from_values( getattr(key, 'version_id', None), getattr(key, 'generation', None), getattr(key, 'is_latest', None), getattr(key, 'md5', None))
(self, key)
5,811
boto.storage_uri
_update_from_values
null
def _update_from_values(self, version_id, generation, is_latest, md5): self.version_id = version_id self.generation = generation self.is_latest = is_latest self._build_uri_strings() self.md5 = md5
(self, version_id, generation, is_latest, md5)
5,812
boto.storage_uri
_warn_about_args
null
def _warn_about_args(self, function_name, **args): for arg in args: if args[arg]: sys.stderr.write( 'Warning: %s ignores argument: %s=%s\n' % (function_name, arg, str(args[arg])))
(self, function_name, **args)
5,813
boto.storage_uri
acl_class
null
def acl_class(self): conn = self.connect() acl_class = conn.provider.acl_class self.check_response(acl_class, 'acl_class', self.uri) return acl_class
(self)
5,814
boto.storage_uri
add_email_grant
null
def add_email_grant(self, permission, email_address, recursive=False, validate=False, headers=None): self._check_bucket_uri('add_email_grant') if not self.object_name: bucket = self.get_bucket(validate, headers) bucket.add_email_grant(permission, email_address, recursive, ...
(self, permission, email_address, recursive=False, validate=False, headers=None)
5,815
boto.storage_uri
add_group_email_grant
null
def add_group_email_grant(self, permission, email_address, recursive=False, validate=False, headers=None): self._check_bucket_uri('add_group_email_grant') if self.scheme != 'gs': raise ValueError('add_group_email_grant() not supported for %s ' 'URIs.' %...
(self, permission, email_address, recursive=False, validate=False, headers=None)
5,816
boto.storage_uri
add_user_grant
null
def add_user_grant(self, permission, user_id, recursive=False, validate=False, headers=None): self._check_bucket_uri('add_user_grant') if not self.object_name: bucket = self.get_bucket(validate, headers) bucket.add_user_grant(permission, user_id, recursive, headers) else: ...
(self, permission, user_id, recursive=False, validate=False, headers=None)
5,817
boto.storage_uri
canned_acls
null
def canned_acls(self): conn = self.connect() canned_acls = conn.provider.canned_acls self.check_response(canned_acls, 'canned_acls', self.uri) return canned_acls
(self)
5,818
boto.storage_uri
check_response
null
def check_response(self, resp, level, uri): if resp is None: raise InvalidUriError('\n'.join(textwrap.wrap( 'Attempt to get %s for "%s" failed. This can happen if ' 'the URI refers to a non-existent object or if you meant to ' 'operate on a directory (e.g., leaving off -R...
(self, resp, level, uri)
5,819
boto.storage_uri
clone_replace_key
Instantiate a BucketStorageUri from the current BucketStorageUri, by replacing the object name with the object name and other metadata found in the given Key object (including generation). @type key: Key @param key: key for the new StorageUri to represent
def clone_replace_key(self, key): """Instantiate a BucketStorageUri from the current BucketStorageUri, by replacing the object name with the object name and other metadata found in the given Key object (including generation). @type key: Key @param key: key for the new StorageUri to represent """...
(self, key)
5,820
boto.storage_uri
clone_replace_name
Instantiate a BucketStorageUri from the current BucketStorageUri, but replacing the object_name. @type new_name: string @param new_name: new object name
def clone_replace_name(self, new_name): """Instantiate a BucketStorageUri from the current BucketStorageUri, but replacing the object_name. @type new_name: string @param new_name: new object name """ self._check_bucket_uri('clone_replace_name') return BucketStorageUri( self.scheme, b...
(self, new_name)
5,821
boto.storage_uri
compose
null
def compose(self, components, content_type=None, headers=None): self._check_object_uri('compose') component_keys = [] for suri in components: component_keys.append(suri.new_key()) component_keys[-1].generation = suri.generation self.generation = self.new_key().compose( component_...
(self, components, content_type=None, headers=None)
5,822
boto.storage_uri
configure_billing
Sets or updates a bucket's billing configuration.
def configure_billing(self, requester_pays=False, validate=False, headers=None): """Sets or updates a bucket's billing configuration.""" self._check_bucket_uri('configure_billing') # billing is defined as a bucket param for GCS, but not for S3. if self.scheme != 'gs': raise...
(self, requester_pays=False, validate=False, headers=None)
5,823
boto.storage_uri
configure_lifecycle
Sets or updates a bucket's lifecycle configuration.
def configure_lifecycle(self, lifecycle_config, validate=False, headers=None): """Sets or updates a bucket's lifecycle configuration.""" self._check_bucket_uri('configure_lifecycle') bucket = self.get_bucket(validate, headers) bucket.configure_lifecycle(lifecycle_config, headers)...
(self, lifecycle_config, validate=False, headers=None)
5,824
boto.storage_uri
configure_versioning
null
def configure_versioning(self, enabled, headers=None): self._check_bucket_uri('configure_versioning') bucket = self.get_bucket(False, headers) return bucket.configure_versioning(enabled, headers)
(self, enabled, headers=None)
5,825
boto.storage_uri
connect
Opens a connection to appropriate provider, depending on provider portion of URI. Requires Credentials defined in boto config file (see boto/pyami/config.py). @type storage_uri: StorageUri @param storage_uri: StorageUri specifying a bucket or a bucket+object @rtype: L{AW...
def connect(self, access_key_id=None, secret_access_key=None, **kwargs): """ Opens a connection to appropriate provider, depending on provider portion of URI. Requires Credentials defined in boto config file (see boto/pyami/config.py). @type storage_uri: StorageUri @param storage_uri: StorageUri...
(self, access_key_id=None, secret_access_key=None, **kwargs)
5,826
boto.storage_uri
copy_key
Returns newly created key.
def copy_key(self, src_bucket_name, src_key_name, metadata=None, src_version_id=None, storage_class='STANDARD', preserve_acl=False, encrypt_key=False, headers=None, query_args=None, src_generation=None): """Returns newly created key.""" self._check_object_uri('copy_key') ...
(self, src_bucket_name, src_key_name, metadata=None, src_version_id=None, storage_class='STANDARD', preserve_acl=False, encrypt_key=False, headers=None, query_args=None, src_generation=None)
5,827
boto.storage_uri
create_bucket
null
def create_bucket(self, headers=None, location='', policy=None, storage_class=None): self._check_bucket_uri('create_bucket ') conn = self.connect() # Pass storage_class param only if this is a GCS bucket. (In S3 the # storage class is specified on the key object.) if self.scheme ==...
(self, headers=None, location='', policy=None, storage_class=None)
5,828
boto.storage_uri
delete_bucket
null
def delete_bucket(self, headers=None): self._check_bucket_uri('delete_bucket') conn = self.connect() return conn.delete_bucket(self.bucket_name, headers)
(self, headers=None)
5,829
boto.storage_uri
delete_key
null
def delete_key(self, validate=False, headers=None, version_id=None, mfa_token=None): self._check_object_uri('delete_key') bucket = self.get_bucket(validate, headers) if self.get_provider().name == 'aws': version_id = version_id or self.version_id return bucket.delete_key(self....
(self, validate=False, headers=None, version_id=None, mfa_token=None)
5,830
boto.storage_uri
disable_logging
null
def disable_logging(self, validate=False, headers=None, version_id=None): self._check_bucket_uri('disable_logging') bucket = self.get_bucket(validate, headers) bucket.disable_logging(headers=headers)
(self, validate=False, headers=None, version_id=None)
5,831
boto.storage_uri
enable_logging
null
def enable_logging(self, target_bucket, target_prefix=None, validate=False, headers=None, version_id=None): self._check_bucket_uri('enable_logging') bucket = self.get_bucket(validate, headers) bucket.enable_logging(target_bucket, target_prefix, headers=headers)
(self, target_bucket, target_prefix=None, validate=False, headers=None, version_id=None)
5,832
boto.storage_uri
equals
Returns true if two URIs are equal.
def equals(self, uri): """Returns true if two URIs are equal.""" return self.uri == uri.uri
(self, uri)