text stringlengths 81 112k |
|---|
Send messages through RabbitMQ's default exchange,
which will be delivered through routing_key (sess_id).
This method only used for un-authenticated users, i.e. login process.
Args:
sess_id string: Session id
message dict: Message object.
def send_to_default_exchange(s... |
Send messages through logged in users private exchange.
Args:
user_id string: User key
message dict: Message object
def send_to_prv_exchange(self, user_id, message=None):
"""
Send messages through logged in users private exchange.
Args:
user_id stri... |
compose 2 graphs to CGR
:param other: Molecule or CGR Container
:return: CGRContainer
def compose(self, other):
"""
compose 2 graphs to CGR
:param other: Molecule or CGR Container
:return: CGRContainer
"""
if not isinstance(other, Compose):
... |
decompose CGR to pair of Molecules, which represents reactants and products state of reaction
:return: tuple of two molecules
def decompose(self):
"""
decompose CGR to pair of Molecules, which represents reactants and products state of reaction
:return: tuple of two molecules
... |
Get data from JIRA for cycle/flow times and story points size change.
Build a numerically indexed data frame with the following 'fixed'
columns: `key`, 'url', 'issue_type', `summary`, `status`, and
`resolution` from JIRA, as well as the value of any fields set in
the `fields` dict in `s... |
Return the a DataFrame,
indexed by day, with columns containing story size for each issue.
In addition, columns are soted by Jira Issue key. First by Project and then by id number.
def size_history(self,size_data):
"""Return the a DataFrame,
indexed by day, with columns containing stor... |
Return the data to build a cumulative flow diagram: a DataFrame,
indexed by day, with columns containing cumulative counts for each
of the items in the configured cycle.
In addition, a column called `cycle_time` contains the approximate
average cycle time of that day based on the first ... |
Return histogram data for the cycle times in `cycle_data`. Returns
a dictionary with keys `bin_values` and `bin_edges` of numpy arrays
def histogram(self, cycle_data, bins=10):
"""Return histogram data for the cycle times in `cycle_data`. Returns
a dictionary with keys `bin_values` and `bin_edg... |
Return a data frame with columns `completed_timestamp` of the
given frequency, either
`count`, where count is the number of items
'sum', where sum is the sum of value specified by pointscolumn. Expected to be 'StoryPoints'
completed at that timestamp (e.g. daily).
def throughput_data(se... |
Return scatterplot data for the cycle times in `cycle_data`. Returns
a data frame containing only those items in `cycle_data` where values
are set for `completed_timestamp` and `cycle_time`, and with those two
columns as the first two, both normalised to whole days, and with
`completed_t... |
Is NSQ running and have space to receive messages?
def _is_ready(self, topic_name):
'''
Is NSQ running and have space to receive messages?
'''
url = 'http://%s/stats?format=json&topic=%s' % (self.nsqd_http_address, topic_name)
#Cheacking for ephmeral channels
if '#' in t... |
QueryContainer < MoleculeContainer
QueryContainer < QueryContainer[more general]
QueryContainer < QueryCGRContainer[more general]
def _matcher(self, other):
"""
QueryContainer < MoleculeContainer
QueryContainer < QueryContainer[more general]
QueryContainer < QueryCGRCont... |
QueryCGRContainer < CGRContainer
QueryContainer < QueryCGRContainer[more general]
def _matcher(self, other):
"""
QueryCGRContainer < CGRContainer
QueryContainer < QueryCGRContainer[more general]
"""
if isinstance(other, CGRContainer):
return GraphMatcher(othe... |
recalculate 2d coordinates. currently rings can be calculated badly.
:param scale: rescale calculated positions.
:param force: ignore existing coordinates of atoms
def calculate2d(self, force=False, scale=1):
"""
recalculate 2d coordinates. currently rings can be calculated badly.
... |
Finds all possible knight moves
:type: position Board
:rtype: list
def possible_moves(self, position):
"""
Finds all possible knight moves
:type: position Board
:rtype: list
"""
for direction in [0, 1, 2, 3]:
angles = self._rotate_direction_ni... |
get a list of lists of atoms of reaction centers
def centers_list(self):
""" get a list of lists of atoms of reaction centers
"""
center = set()
adj = defaultdict(set)
for n, atom in self.atoms():
if atom._reactant != atom._product:
center.add(n)
... |
get list of atoms of reaction center (atoms with dynamic: bonds, charges, radicals).
def center_atoms(self):
""" get list of atoms of reaction center (atoms with dynamic: bonds, charges, radicals).
"""
nodes = set()
for n, atom in self.atoms():
if atom._reactant != atom._pro... |
get list of bonds of reaction center (bonds with dynamic orders).
def center_bonds(self):
""" get list of bonds of reaction center (bonds with dynamic orders).
"""
return [(n, m) for n, m, bond in self.bonds() if bond._reactant != bond._product] |
set or reset hyb and neighbors marks to atoms.
def reset_query_marks(self):
"""
set or reset hyb and neighbors marks to atoms.
"""
for i, atom in self.atoms():
neighbors = 0
hybridization = 1
p_neighbors = 0
p_hybridization = 1
... |
create substructure containing atoms from nbunch list
:param atoms: list of atoms numbers of substructure
:param meta: if True metadata will be copied to substructure
:param as_view: If True, the returned graph-view provides a read-only view
of the original structure scaffold withou... |
CGRContainer < CGRContainer
def _matcher(self, other):
"""
CGRContainer < CGRContainer
"""
if isinstance(other, CGRContainer):
return GraphMatcher(other, self, lambda x, y: x == y, lambda x, y: x == y)
raise TypeError('only cgr-cgr possible') |
modified NX fast BFS node generator
def __plain_bfs(adj, source):
"""modified NX fast BFS node generator"""
seen = set()
nextlevel = {source}
while nextlevel:
thislevel = nextlevel
nextlevel = set()
for v in thislevel:
if v not in seen... |
Returns authorization token provided by Cocaine.
The real meaning of the token is determined by its type. For example OAUTH2 token will
have "bearer" type.
:return: A tuple of token type and body.
def token(self):
"""
Returns authorization token provided by Cocaine.
T... |
Send a message lazy formatted with args.
External log attributes can be passed via named attribute `extra`,
like in logging from the standart library.
Note:
* Attrs must be dict, otherwise the whole message would be skipped.
* The key field in an attr is converted to str... |
Finds moves in a given direction
:type: direction: lambda
:type: position: Board
:rtype: list
def moves_in_direction(self, direction, position):
"""
Finds moves in a given direction
:type: direction: lambda
:type: position: Board
:rtype: list
""... |
Returns all possible rook moves.
:type: position: Board
:rtype: list
def possible_moves(self, position):
"""
Returns all possible rook moves.
:type: position: Board
:rtype: list
"""
for move in itertools.chain(*[self.moves_in_direction(fn, position) for... |
Check overlap between two arrays.
Parameters
----------
a, b : array-like
Arrays to check. Assumed to be in the same unit.
Returns
-------
result : {'full', 'partial', 'none'}
* 'full' - ``a`` is within or same as ``b``
* 'partial' - ``a`` partially overlaps with ``b``
... |
Check integrated flux for invalid values.
Parameters
----------
totalflux : float
Integrated flux.
Raises
------
synphot.exceptions.SynphotError
Input is zero, negative, or not a number.
def validate_totalflux(totalflux):
"""Check integrated flux for invalid values.
P... |
Check wavelengths for ``synphot`` compatibility.
Wavelengths must satisfy these conditions:
* valid unit type, if given
* no zeroes
* monotonic ascending or descending
* no duplicate values
Parameters
----------
wavelengths : array-like or `~astropy.units.quantity.Quan... |
Generate wavelength array to be used for spectrum sampling.
.. math::
minwave \\le \\lambda < maxwave
Parameters
----------
minwave, maxwave : float
Lower and upper limits of the wavelengths.
These must be values in linear space regardless of ``log``.
num : int
Th... |
Return the union of the two sets of wavelengths using
:func:`numpy.union1d`.
The merged wavelengths may sometimes contain numbers which are nearly
equal but differ at levels as small as 1e-14. Having values this
close together can cause problems down the line. So, here we test
whether any such smal... |
Download CDBS data files to given root directory.
Download is skipped if a data file already exists.
Parameters
----------
cdbs_root : str
Root directory for CDBS data files.
verbose : bool
Print extra information to screen.
dry_run : bool
Go through the logic but skip... |
Demonstrate functionality of PyVLX.
async def main(loop):
"""Demonstrate functionality of PyVLX."""
pyvlx = PyVLX('pyvlx.yaml', loop=loop)
# Alternative:
# pyvlx = PyVLX(host="192.168.2.127", password="velux123", loop=loop)
# Runing scenes:
await pyvlx.load_scenes()
await pyvlx.scenes["All... |
Return Payload.
def get_payload(self):
"""Return Payload."""
if self.password is None:
raise PyVLXException("password is none")
if len(self.password) > self.MAX_SIZE:
raise PyVLXException("password is too long")
return string_to_bytes(self.password, self.MAX_SIZE... |
Add Node, replace existing node if node with node_id is present.
def add(self, node):
"""Add Node, replace existing node if node with node_id is present."""
if not isinstance(node, Node):
raise TypeError()
for i, j in enumerate(self.__nodes):
if j.node_id == node.node_id... |
Load nodes from KLF 200, if no node_id is specified all nodes are loaded.
async def load(self, node_id=None):
"""Load nodes from KLF 200, if no node_id is specified all nodes are loaded."""
if node_id is not None:
await self._load_node(node_id=node_id)
else:
await self._... |
Load single node via API.
async def _load_node(self, node_id):
"""Load single node via API."""
get_node_information = GetNodeInformation(pyvlx=self.pyvlx, node_id=node_id)
await get_node_information.do_api_call()
if not get_node_information.success:
raise PyVLXException("Una... |
Load all nodes via API.
async def _load_all_nodes(self):
"""Load all nodes via API."""
get_all_nodes_information = GetAllNodesInformation(pyvlx=self.pyvlx)
await get_all_nodes_information.do_api_call()
if not get_all_nodes_information.success:
raise PyVLXException("Unable to... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if isinstance(frame, FrameGetAllNodesInformationConfirmation):
self.number_of_nodes = frame.number_of_node... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if isinstance(frame, FrameGetNodeInformationConfirmation) and frame.node_id == self.node_id:
# We are stil... |
Create loop task.
def start(self):
"""Create loop task."""
self.run_task = self.pyvlx.loop.create_task(
self.loop()) |
Stop heartbeat.
async def stop(self):
"""Stop heartbeat."""
self.stopped = True
self.loop_event.set()
# Waiting for shutdown of loop()
await self.stopped_event.wait() |
Pulse every timeout seconds until stopped.
async def loop(self):
"""Pulse every timeout seconds until stopped."""
while not self.stopped:
self.timeout_handle = self.pyvlx.connection.loop.call_later(
self.timeout_in_seconds, self.loop_timeout)
await self.loop_even... |
Send get state request to API to keep the connection alive.
async def pulse(self):
"""Send get state request to API to keep the connection alive."""
get_state = GetState(pyvlx=self.pyvlx)
await get_state.do_api_call()
if not get_state.success:
raise PyVLXException("Unable to... |
Return Payload.
def get_payload(self):
"""Return Payload."""
payload = bytes([self.gateway_state.value, self.gateway_sub_state.value])
payload += bytes(4) # State date, reserved for future use
return payload |
Init frame from binary data.
def from_payload(self, payload):
"""Init frame from binary data."""
self.gateway_state = GatewayState(payload[0])
self.gateway_sub_state = GatewaySubState(payload[1]) |
Convert string to bytes add padding.
def string_to_bytes(string, size):
"""Convert string to bytes add padding."""
if len(string) > size:
raise PyVLXException("string_to_bytes::string_to_large")
encoded = bytes(string, encoding='utf-8')
return encoded + bytes(size-len(encoded)) |
Convert bytes to string.
def bytes_to_string(raw):
"""Convert bytes to string."""
ret = bytes()
for byte in raw:
if byte == 0x00:
return ret.decode("utf-8")
ret += bytes([byte])
return ret.decode("utf-8") |
Return Payload.
def get_payload(self):
"""Return Payload."""
payload = bytes([self.node_id])
payload += bytes([self.state])
payload += bytes(self.current_position.raw)
payload += bytes(self.target.raw)
payload += bytes(self.current_position_fp1.raw)
payload += by... |
Init frame from binary data.
def from_payload(self, payload):
"""Init frame from binary data."""
self.node_id = payload[0]
self.state = payload[1]
self.current_position = Parameter(payload[2:4])
self.target = Parameter(payload[4:6])
self.current_position_fp1 = Parameter(... |
Enable house status monitor.
async def house_status_monitor_enable(pyvlx):
"""Enable house status monitor."""
status_monitor_enable = HouseStatusMonitorEnable(pyvlx=pyvlx)
await status_monitor_enable.do_api_call()
if not status_monitor_enable.success:
raise PyVLXException("Unable enable house s... |
Disable house status monitor.
async def house_status_monitor_disable(pyvlx):
"""Disable house status monitor."""
status_monitor_disable = HouseStatusMonitorDisable(pyvlx=pyvlx)
await status_monitor_disable.do_api_call()
if not status_monitor_disable.success:
raise PyVLXException("Unable disable... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if not isinstance(frame, FrameHouseStatusMonitorEnableConfirmation):
return False
self.success = T... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if not isinstance(frame, FrameHouseStatusMonitorDisableConfirmation):
return False
self.success = ... |
An 'argument type' for integrations with the argparse module.
For more information, see
https://docs.python.org/2/library/argparse.html#type Of particular
interest to us is this bit:
``type=`` can take any callable that takes a single string
argument and returns the converted value
I.e., ``type`` can be a func... |
Updates the widget with the current NIST/SI speed.
Basically, this calculates the average rate of update and figures out
how to make a "pretty" prefix unit
def update(self, pbar):
"""Updates the widget with the current NIST/SI speed.
Basically, this calculates the average rate of update and figures out
how t... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if isinstance(frame, FrameCommandSendConfirmation) and frame.session_id == self.session_id:
if frame.statu... |
Construct initiating frame.
def request_frame(self):
"""Construct initiating frame."""
self.session_id = get_new_session_id()
return FrameCommandSendRequest(node_ids=[self.node_id], parameter=self.parameter, session_id=self.session_id) |
Read configuration file.
def read_config(self, path):
"""Read configuration file."""
PYVLXLOG.info('Reading config file: %s', path)
try:
with open(path, 'r') as filehandle:
doc = yaml.safe_load(filehandle)
self.test_configuration(doc, path)
... |
Setup apiv2 when using PyQt4 and Python2.
def setup_apiv2():
"""
Setup apiv2 when using PyQt4 and Python2.
"""
# setup PyQt api to version 2
if sys.version_info[0] == 2:
logging.getLogger(__name__).debug(
'setting up SIP API to version 2')
import sip
try:
... |
Auto-detects and use the first available QT_API by importing them in the
following order:
1) PyQt5
2) PyQt4
3) PySide
def autodetect():
"""
Auto-detects and use the first available QT_API by importing them in the
following order:
1) PyQt5
2) PyQt4
3) PySide
"""
logging... |
Read roller shutter from config.
def from_config(cls, pyvlx, item):
"""Read roller shutter from config."""
name = item['name']
ident = item['id']
subtype = item['subtype']
typeid = item['typeId']
return cls(pyvlx, ident, name, subtype, typeid) |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if isinstance(frame, FrameGetSceneListConfirmation):
self.count_scenes = frame.count_scenes
if... |
Return Payload.
def get_payload(self):
"""Return Payload."""
ret = bytes([len(self.scenes)])
for number, name in self.scenes:
ret += bytes([number])
ret += string_to_bytes(name, 64)
ret += bytes([self.remaining_scenes])
return ret |
Init frame from binary data.
def from_payload(self, payload):
"""Init frame from binary data."""
number_of_objects = payload[0]
self.remaining_scenes = payload[-1]
predicted_len = number_of_objects * 65 + 2
if len(payload) != predicted_len:
raise PyVLXException('scen... |
Read FITS or ASCII spectrum from a remote location.
Parameters
----------
filename : str
Spectrum filename.
encoding, cache, show_progress
See :func:`~astropy.utils.data.get_readable_fileobj`.
kwargs : dict
Keywords acceptable by :func:`read_fits_spec` (if FITS) or
... |
Read FITS or ASCII spectrum.
Parameters
----------
filename : str or file pointer
Spectrum file name or pointer.
fname : str
Filename. This is *only* used if ``filename`` is a pointer.
kwargs : dict
Keywords acceptable by :func:`read_fits_spec` (if FITS) or
:func:`... |
Read ASCII spectrum.
ASCII table must have following columns:
#. Wavelength data
#. Flux data
It can have more than 2 columns but the rest is ignored.
Comments are discarded.
Parameters
----------
filename : str or file pointer
Spectrum file name or pointer.
wave... |
Read FITS spectrum.
Wavelength and flux units are extracted from ``TUNIT1`` and ``TUNIT2``
keywords, respectively, from data table (not primary) header.
If these keywords are not present, units are taken from
``wave_unit`` and ``flux_unit`` instead.
Parameters
----------
filename : str or ... |
Write FITS spectrum.
.. warning::
If data is being written out as single-precision but wavelengths
are in double-precision, some rows may be omitted.
Parameters
----------
filename : str
Output spectrum filename.
wavelengths, fluxes : array-like or `~astropy.units.quantit... |
Flux equivalencies between PHOTLAM and VEGAMAG.
Parameters
----------
wav : `~astropy.units.quantity.Quantity`
Quantity associated with values being converted
(e.g., wavelength or frequency).
vegaflux : `~astropy.units.quantity.Quantity`
Flux of Vega at ``wav``.
Returns
... |
Flux equivalencies between PHOTLAM and count/OBMAG.
Parameters
----------
wav : `~astropy.units.quantity.Quantity`
Quantity associated with values being converted
(e.g., wavelength or frequency).
area : `~astropy.units.quantity.Quantity`
Telescope collecting area.
Returns
... |
Perform conversion for :ref:`supported flux units <synphot-flux-units>`.
Parameters
----------
wavelengths : array-like or `~astropy.units.quantity.Quantity`
Wavelength values. If not a Quantity, assumed to be in
Angstrom.
fluxes : array-like or `~astropy.units.quantity.Quantity`
... |
Flux conversion for PHOTLAM <-> X.
def _convert_flux(wavelengths, fluxes, out_flux_unit, area=None,
vegaspec=None):
"""Flux conversion for PHOTLAM <-> X."""
flux_unit_names = (fluxes.unit.to_string(), out_flux_unit.to_string())
if PHOTLAM.to_string() not in flux_unit_names:
raise... |
Validate unit.
To be compatible with existing SYNPHOT data files:
* 'angstroms' and 'inversemicrons' are accepted although
unrecognized by astropy units
* 'transmission', 'extinction', and 'emissivity' are
converted to astropy dimensionless unit
Parameters
----------
... |
Like :func:`validate_unit` but specific to wavelength.
def validate_wave_unit(wave_unit):
"""Like :func:`validate_unit` but specific to wavelength."""
output_unit = validate_unit(wave_unit)
unit_type = output_unit.physical_type
if unit_type not in ('length', 'wavenumber', 'frequency'):
raise e... |
Validate quantity (value and unit).
.. note::
For flux conversion, use :func:`convert_flux` instead.
Parameters
----------
input_value : number, array-like, or `~astropy.units.quantity.Quantity`
Quantity to validate. If not a Quantity, assumed to be
already in output unit.
... |
Add device.
def add(self, device):
"""Add device."""
if not isinstance(device, Device):
raise TypeError()
self.__devices.append(device) |
Import data from json response.
def data_import(self, json_response):
"""Import data from json response."""
if 'data' not in json_response:
raise PyVLXException('no element data found: {0}'.format(
json.dumps(json_response)))
data = json_response['data']
for... |
Load window opener from JSON.
def load_window_opener(self, item):
"""Load window opener from JSON."""
window = Window.from_config(self.pyvlx, item)
self.add(window) |
Load roller shutter from JSON.
def load_roller_shutter(self, item):
"""Load roller shutter from JSON."""
rollershutter = RollerShutter.from_config(self.pyvlx, item)
self.add(rollershutter) |
Load blind from JSON.
def load_blind(self, item):
"""Load blind from JSON."""
blind = Blind.from_config(self.pyvlx, item)
self.add(blind) |
Return tuple containing columns and rows of controlling terminal, trying harder
than shutil.get_terminal_size to find a tty before returning fallback.
Theoretically, stdout, stderr, and stdin could all be different ttys that could
cause us to get the wrong measurements (instead of using the fallback) but t... |
Run checks on self.files, printing diff of styled/unstyled output to stdout.
def run_diff(self):
"""
Run checks on self.files, printing diff of styled/unstyled output to stdout.
"""
files = tuple(self.files)
# Use same header as more.
header, footer = (termcolor.colored(... |
Run checks on self.files, printing json object
containing information relavent to the CS50 IDE plugin at the end.
def run_json(self):
"""
Run checks on self.files, printing json object
containing information relavent to the CS50 IDE plugin at the end.
"""
checks = {}
... |
Run checks on self.files, printing raw percentage to stdout.
def run_score(self):
"""
Run checks on self.files, printing raw percentage to stdout.
"""
diffs = 0
lines = 0
for file in self.files:
try:
results = self._check(file)
ex... |
Run apropriate check based on `file`'s extension and return it,
otherwise raise an Error
def _check(self, file):
"""
Run apropriate check based on `file`'s extension and return it,
otherwise raise an Error
"""
if not os.path.exists(file):
raise Error("file \... |
Returns a generator yielding the side-by-side diff of `old` and `new`).
def split_diff(old, new):
"""
Returns a generator yielding the side-by-side diff of `old` and `new`).
"""
return map(lambda l: l.rstrip(),
icdiff.ConsoleDiff(cols=COLUMNS).make_table(old.splitline... |
Returns a generator yielding a unified diff between `old` and `new`.
def unified(old, new):
"""
Returns a generator yielding a unified diff between `old` and `new`.
"""
for diff in difflib.ndiff(old.splitlines(), new.splitlines()):
if diff[0] == " ":
yield di... |
Return HTML formatted character-based diff between old and new (used for CS50 IDE).
def html_diff(self, old, new):
"""
Return HTML formatted character-based diff between old and new (used for CS50 IDE).
"""
def html_transition(old_type, new_type):
tags = []
for t... |
Return color-coded character-based diff between `old` and `new`.
def char_diff(self, old, new):
"""
Return color-coded character-based diff between `old` and `new`.
"""
def color_transition(old_type, new_type):
new_color = termcolor.colored("", None, "on_red" if new_type ==
... |
Returns a char-based diff between `old` and `new` where each character
is formatted by `fmt` and transitions between blocks are determined by `transition`.
def _char_diff(self, old, new, transition, fmt=lambda c: c):
"""
Returns a char-based diff between `old` and `new` where each character
... |
Count lines of code (by default ignores empty lines, but child could override to do more).
def count_lines(self, code):
"""
Count lines of code (by default ignores empty lines, but child could override to do more).
"""
return sum(bool(line.strip()) for line in code.splitlines()) |
Run `command` passing it stdin from `input`, throwing a DependencyError if comand is not found.
Throws Error if exit code of command is not `exit` (unless `exit` is None).
def run(command, input=None, exit=0, shell=False):
"""
Run `command` passing it stdin from `input`, throwing a DependencyEr... |
Create and return frame from raw bytes.
def frame_from_raw(raw):
"""Create and return frame from raw bytes."""
command, payload = extract_from_frame(raw)
frame = create_frame(command)
if frame is None:
PYVLXLOG.warning("Command %s not implemented, raw: %s", command, ":".join("{:02x}".format(c) ... |
Create and return empty Frame from Command.
def create_frame(command):
"""Create and return empty Frame from Command."""
# pylint: disable=too-many-branches,too-many-return-statements
if command == Command.GW_ERROR_NTF:
return FrameErrorNotification()
if command == Command.GW_COMMAND_SEND_REQ:
... |
Handle incoming API frame, return True if this was the expected frame.
async def handle_frame(self, frame):
"""Handle incoming API frame, return True if this was the expected frame."""
if not isinstance(frame, FramePasswordEnterConfirmation):
return False
if frame.status == Password... |
Return Payload.
def get_payload(self):
"""Return Payload."""
return bytes(
[self.major_version >> 8 & 255, self.major_version & 255,
self.minor_version >> 8 & 255, self.minor_version & 255]) |
Init frame from binary data.
def from_payload(self, payload):
"""Init frame from binary data."""
self.major_version = payload[0] * 256 + payload[1]
self.minor_version = payload[2] * 256 + payload[3] |
Handle data received.
def data_received(self, data):
"""Handle data received."""
self.tokenizer.feed(data)
while self.tokenizer.has_tokens():
raw = self.tokenizer.get_next_token()
frame = frame_from_raw(raw)
if frame is not None:
self.frame_re... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.