repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
swift-nav/libsbp | generator/sbpg/targets/latex.py | render_source | def render_source(output_dir, package_specs, version):
"""
Render and output
"""
destination_filename = "%s/sbp_out.tex" % output_dir
py_template = JENV.get_template(TEMPLATE_NAME)
stable_msgs = []
unstable_msgs = []
prims = []
for p in sorted(package_specs, key=attrgetter('identifier')):
pkg_name... | python | def render_source(output_dir, package_specs, version):
"""
Render and output
"""
destination_filename = "%s/sbp_out.tex" % output_dir
py_template = JENV.get_template(TEMPLATE_NAME)
stable_msgs = []
unstable_msgs = []
prims = []
for p in sorted(package_specs, key=attrgetter('identifier')):
pkg_name... | Render and output | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/latex.py#L255-L311 |
swift-nav/libsbp | python/sbp/client/examples/udp.py | get_args | def get_args():
"""
Get and parse arguments.
"""
import argparse
parser = argparse.ArgumentParser(
description="Swift Navigation SBP Example.")
parser.add_argument(
"-s",
"--serial-port",
default=[DEFAULT_SERIAL_PORT],
nargs=1,
help="specify the se... | python | def get_args():
"""
Get and parse arguments.
"""
import argparse
parser = argparse.ArgumentParser(
description="Swift Navigation SBP Example.")
parser.add_argument(
"-s",
"--serial-port",
default=[DEFAULT_SERIAL_PORT],
nargs=1,
help="specify the se... | Get and parse arguments. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/examples/udp.py#L31-L62 |
swift-nav/libsbp | generator/sbpg/targets/c.py | commentify | def commentify(value):
"""
Builds a comment.
"""
value = markdown_links(value)
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | python | def commentify(value):
"""
Builds a comment.
"""
value = markdown_links(value)
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | Builds a comment. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/c.py#L22-L32 |
swift-nav/libsbp | generator/sbpg/targets/c.py | convert | def convert(value):
"""Converts to a C language appropriate identifier format.
"""
s0 = "Sbp" + value if value in COLLISIONS else value
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s0)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + "_t" | python | def convert(value):
"""Converts to a C language appropriate identifier format.
"""
s0 = "Sbp" + value if value in COLLISIONS else value
s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', s0)
return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() + "_t" | Converts to a C language appropriate identifier format. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/c.py#L47-L53 |
swift-nav/libsbp | generator/sbpg/targets/c.py | mk_id | def mk_id(field):
"""Builds an identifier from a field.
"""
name = field.type_id
if name == "string":
return "%s" % ("char")
elif name == "array" and field.size:
if field.options['fill'].value not in CONSTRUCT_CODE:
return "%s" % convert(field.options['fill'].value)
else:
return "%s" %... | python | def mk_id(field):
"""Builds an identifier from a field.
"""
name = field.type_id
if name == "string":
return "%s" % ("char")
elif name == "array" and field.size:
if field.options['fill'].value not in CONSTRUCT_CODE:
return "%s" % convert(field.options['fill'].value)
else:
return "%s" %... | Builds an identifier from a field. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/c.py#L55-L71 |
swift-nav/libsbp | generator/sbpg/targets/c.py | mk_size | def mk_size(field):
"""Builds an identifier for a container type.
"""
name = field.type_id
if name == "string" and field.options.get('size', None):
return "%s[%d];" % (field.identifier, field.options.get('size').value)
elif name == "string":
return "%s[0];" % field.identifier
elif name == "array" an... | python | def mk_size(field):
"""Builds an identifier for a container type.
"""
name = field.type_id
if name == "string" and field.options.get('size', None):
return "%s[%d];" % (field.identifier, field.options.get('size').value)
elif name == "string":
return "%s[0];" % field.identifier
elif name == "array" an... | Builds an identifier for a container type. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/c.py#L73-L86 |
swift-nav/libsbp | generator/sbpg/targets/c.py | render_source | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
destination_filename = "%s/%s.h" % (output_dir, name)
py_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)
with open(destination_filename, 'w') as f:
... | python | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
destination_filename = "%s/%s.h" % (output_dir, name)
py_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)
with open(destination_filename, 'w') as f:
... | Render and output to a directory given a package specification. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/c.py#L93-L107 |
swift-nav/libsbp | python/sbp/msg.py | crc16jit | def crc16jit(buf, offset, crc, length):
"""CRC16 implementation acording to CCITT standards."""
for index in range(offset, offset + length):
data = buf[index]
lookup = crc16_tab[((nb.u2(crc) >> 8) & nb.u2(0xFF)) ^ (data & nb.u2(0xFF))]
crc = ((nb.u2(crc) << nb.u2(8)) & nb.u2(0xFFFF)) ^ lookup
crc = ... | python | def crc16jit(buf, offset, crc, length):
"""CRC16 implementation acording to CCITT standards."""
for index in range(offset, offset + length):
data = buf[index]
lookup = crc16_tab[((nb.u2(crc) >> 8) & nb.u2(0xFF)) ^ (data & nb.u2(0xFF))]
crc = ((nb.u2(crc) << nb.u2(8)) & nb.u2(0xFFFF)) ^ lookup
crc = ... | CRC16 implementation acording to CCITT standards. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L66-L73 |
swift-nav/libsbp | python/sbp/msg.py | crc16_nojit | def crc16_nojit(s, crc=0):
"""CRC16 implementation acording to CCITT standards."""
for ch in bytearray(s): # bytearray's elements are integers in both python 2 and 3
crc = ((crc << 8) & 0xFFFF) ^ _crc16_tab[((crc >> 8) & 0xFF) ^ (ch & 0xFF)]
crc &= 0xFFFF
return crc | python | def crc16_nojit(s, crc=0):
"""CRC16 implementation acording to CCITT standards."""
for ch in bytearray(s): # bytearray's elements are integers in both python 2 and 3
crc = ((crc << 8) & 0xFFFF) ^ _crc16_tab[((crc >> 8) & 0xFF) ^ (ch & 0xFF)]
crc &= 0xFFFF
return crc | CRC16 implementation acording to CCITT standards. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L84-L89 |
swift-nav/libsbp | python/sbp/msg.py | SBP._get_framed | def _get_framed(self, buf, offset, insert_payload):
"""Returns the framed message and updates the CRC.
"""
header_offset = offset + self._header_len
self.length = insert_payload(buf, header_offset, self.payload)
struct.pack_into(self._header_fmt,
buf,
offse... | python | def _get_framed(self, buf, offset, insert_payload):
"""Returns the framed message and updates the CRC.
"""
header_offset = offset + self._header_len
self.length = insert_payload(buf, header_offset, self.payload)
struct.pack_into(self._header_fmt,
buf,
offse... | Returns the framed message and updates the CRC. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L172-L191 |
swift-nav/libsbp | python/sbp/msg.py | SBP.pack | def pack(self):
"""Pack to framed binary message.
"""
buf = np.zeros(512, dtype=np.uint8)
packed_len = self._get_framed(buf, 0, self._copy_payload)
d = buf[:packed_len]
return d.tobytes() | python | def pack(self):
"""Pack to framed binary message.
"""
buf = np.zeros(512, dtype=np.uint8)
packed_len = self._get_framed(buf, 0, self._copy_payload)
d = buf[:packed_len]
return d.tobytes() | Pack to framed binary message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L193-L200 |
swift-nav/libsbp | python/sbp/msg.py | SBP.pack_into | def pack_into(self, buf, offset, write_payload):
"""Pack to framed binary message.
"""
return self._get_framed(buf, offset, write_payload) | python | def pack_into(self, buf, offset, write_payload):
"""Pack to framed binary message.
"""
return self._get_framed(buf, offset, write_payload) | Pack to framed binary message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L202-L206 |
swift-nav/libsbp | python/sbp/msg.py | SBP.unpack | def unpack(d):
"""Unpack and return a framed binary message.
"""
p = SBP._parser.parse(d)
assert p.preamble == SBP_PREAMBLE, "Invalid preamble 0x%x." % p.preamble
return SBP(p.msg_type, p.sender, p.length, p.payload, p.crc) | python | def unpack(d):
"""Unpack and return a framed binary message.
"""
p = SBP._parser.parse(d)
assert p.preamble == SBP_PREAMBLE, "Invalid preamble 0x%x." % p.preamble
return SBP(p.msg_type, p.sender, p.length, p.payload, p.crc) | Unpack and return a framed binary message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L209-L215 |
swift-nav/libsbp | python/sbp/msg.py | SBP.to_json | def to_json(self, sort_keys=False):
"""Produce a JSON-encoded SBP message.
"""
d = self.to_json_dict()
return json.dumps(d, sort_keys=sort_keys) | python | def to_json(self, sort_keys=False):
"""Produce a JSON-encoded SBP message.
"""
d = self.to_json_dict()
return json.dumps(d, sort_keys=sort_keys) | Produce a JSON-encoded SBP message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L234-L239 |
swift-nav/libsbp | python/sbp/msg.py | SBP.from_json | def from_json(s):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return sbp | python | def from_json(s):
"""Given a JSON-encoded message, build an object.
"""
d = json.loads(s)
sbp = SBP.from_json_dict(d)
return sbp | Given a JSON-encoded message, build an object. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/msg.py#L242-L248 |
swift-nav/libsbp | python/sbp/client/drivers/pyserial_driver.py | PySerialDriver.read | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read.
"""
try:
return self.handle.read(size)
except (OSError, serial.SerialException):
print()
print("Piksi disconnec... | python | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read.
"""
try:
return self.handle.read(size)
except (OSError, serial.SerialException):
print()
print("Piksi disconnec... | Read wrapper.
Parameters
----------
size : int
Number of bytes to read. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/pyserial_driver.py#L69-L85 |
swift-nav/libsbp | python/sbp/client/drivers/pyserial_driver.py | PySerialDriver.write | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
return self.handle.write(s)
except (OSError, serial.SerialException,
serial.writeTimeoutError) as e:
if e == s... | python | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
return self.handle.write(s)
except (OSError, serial.SerialException,
serial.writeTimeoutError) as e:
if e == s... | Write wrapper.
Parameters
----------
s : bytes
Bytes to write | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/pyserial_driver.py#L87-L108 |
swift-nav/libsbp | generator/sbpg/targets/java.py | commentify | def commentify(value):
"""
Builds a comment.
"""
value = comment_links(value)
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | python | def commentify(value):
"""
Builds a comment.
"""
value = comment_links(value)
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | Builds a comment. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/java.py#L60-L70 |
swift-nav/libsbp | generator/sbpg/targets/java.py | parse_type | def parse_type(field):
"""
Function to pull a type from the binary payload.
"""
if field.type_id == 'string':
if 'size' in field.options:
return "parser.getString(%d)" % field.options['size'].value
else:
return "parser.getString()"
elif field.type_id in JAVA_TYPE_MAP:
# Primitive java ... | python | def parse_type(field):
"""
Function to pull a type from the binary payload.
"""
if field.type_id == 'string':
if 'size' in field.options:
return "parser.getString(%d)" % field.options['size'].value
else:
return "parser.getString()"
elif field.type_id in JAVA_TYPE_MAP:
# Primitive java ... | Function to pull a type from the binary payload. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/java.py#L81-L108 |
swift-nav/libsbp | generator/sbpg/targets/java.py | build_type | def build_type(field):
"""
Function to pack a type into the binary payload.
"""
if field.type_id == 'string':
if 'size' in field.options:
return "builder.putString(%s, %d)" % (field.identifier, field.options['size'].value)
else:
return "builder.putString(%s)" % field.identifier
elif field.... | python | def build_type(field):
"""
Function to pack a type into the binary payload.
"""
if field.type_id == 'string':
if 'size' in field.options:
return "builder.putString(%s, %d)" % (field.identifier, field.options['size'].value)
else:
return "builder.putString(%s)" % field.identifier
elif field.... | Function to pack a type into the binary payload. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/java.py#L110-L138 |
swift-nav/libsbp | generator/sbpg/targets/java.py | render_source | def render_source(output_dir, package_spec, jenv=JENV):
"""
Render and output
"""
path, module_name = package_spec.filepath
java_template = jenv.get_template(TEMPLATE_NAME)
module_path = "com." + package_spec.identifier
yaml_filepath = "/".join(package_spec.filepath) + ".yaml"
includes = [".".join(i.spl... | python | def render_source(output_dir, package_spec, jenv=JENV):
"""
Render and output
"""
path, module_name = package_spec.filepath
java_template = jenv.get_template(TEMPLATE_NAME)
module_path = "com." + package_spec.identifier
yaml_filepath = "/".join(package_spec.filepath) + ".yaml"
includes = [".".join(i.spl... | Render and output | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/java.py#L158-L183 |
swift-nav/libsbp | generator/sbpg/targets/java.py | render_table | def render_table(output_dir, packages, jenv=JENV):
"""
Render and output dispatch table
"""
destination_filename = output_dir + "/com/swiftnav/sbp/client/MessageTable.java"
with open(destination_filename, 'w+') as f:
print(destination_filename)
f.write(jenv.get_template(TEMPLATE_TABLE_NAME).render... | python | def render_table(output_dir, packages, jenv=JENV):
"""
Render and output dispatch table
"""
destination_filename = output_dir + "/com/swiftnav/sbp/client/MessageTable.java"
with open(destination_filename, 'w+') as f:
print(destination_filename)
f.write(jenv.get_template(TEMPLATE_TABLE_NAME).render... | Render and output dispatch table | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/java.py#L185-L192 |
swift-nav/libsbp | generator/sbpg/targets/javascript.py | construct_format | def construct_format(f, type_map=CONSTRUCT_CODE):
"""
Formats for binary-parser library.
"""
formatted = ""
if type_map.get(f.type_id, None):
return "%s('%s')" % (type_map.get(f.type_id), f.identifier)
elif f.type_id == 'string' and f.options.get('size', None):
return "string('%s', { length: %d })" ... | python | def construct_format(f, type_map=CONSTRUCT_CODE):
"""
Formats for binary-parser library.
"""
formatted = ""
if type_map.get(f.type_id, None):
return "%s('%s')" % (type_map.get(f.type_id), f.identifier)
elif f.type_id == 'string' and f.options.get('size', None):
return "string('%s', { length: %d })" ... | Formats for binary-parser library. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/javascript.py#L120-L153 |
swift-nav/libsbp | generator/sbpg/targets/javascript.py | js_classnameify | def js_classnameify(s):
"""
Makes a classname.
"""
if not '_' in s:
return s
return ''.join(w[0].upper() + w[1:].lower() for w in s.split('_')) | python | def js_classnameify(s):
"""
Makes a classname.
"""
if not '_' in s:
return s
return ''.join(w[0].upper() + w[1:].lower() for w in s.split('_')) | Makes a classname. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/javascript.py#L156-L162 |
swift-nav/libsbp | python/sbp/observation.py | MsgEphemerisGPSDepF.from_binary | def from_binary(self, d):
"""Given a binary payload d, update the appropriate payload fields of
the message.
"""
p = MsgEphemerisGPSDepF._parser.parse(d)
for n in self.__class__.__slots__:
setattr(self, n, getattr(p, n)) | python | def from_binary(self, d):
"""Given a binary payload d, update the appropriate payload fields of
the message.
"""
p = MsgEphemerisGPSDepF._parser.parse(d)
for n in self.__class__.__slots__:
setattr(self, n, getattr(p, n)) | Given a binary payload d, update the appropriate payload fields of
the message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/observation.py#L1715-L1722 |
swift-nav/libsbp | python/sbp/observation.py | MsgEphemerisGPSDepF.to_binary | def to_binary(self):
"""Produce a framed/packed SBP message.
"""
c = containerize(exclude_fields(self))
self.payload = MsgEphemerisGPSDepF._parser.build(c)
return self.pack() | python | def to_binary(self):
"""Produce a framed/packed SBP message.
"""
c = containerize(exclude_fields(self))
self.payload = MsgEphemerisGPSDepF._parser.build(c)
return self.pack() | Produce a framed/packed SBP message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/observation.py#L1724-L1730 |
swift-nav/libsbp | python/sbp/observation.py | MsgEphemerisGPSDepF.into_buffer | def into_buffer(self, buf, offset):
"""Produce a framed/packed SBP message into the provided buffer and offset.
"""
self.payload = containerize(exclude_fields(self))
self.parser = MsgEphemerisGPSDepF._parser
self.stream_payload.reset(buf, offset)
return self.pack_into(buf, offset, self._build_p... | python | def into_buffer(self, buf, offset):
"""Produce a framed/packed SBP message into the provided buffer and offset.
"""
self.payload = containerize(exclude_fields(self))
self.parser = MsgEphemerisGPSDepF._parser
self.stream_payload.reset(buf, offset)
return self.pack_into(buf, offset, self._build_p... | Produce a framed/packed SBP message into the provided buffer and offset. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/observation.py#L1732-L1739 |
swift-nav/libsbp | python/sbp/client/framer.py | Framer._readall | def _readall(self, size):
"""
Read until all bytes are collected.
Parameters
----------
size : int
Number of bytes to read.
"""
data = b""
while len(data) < size:
d = self._read(size - len(data))
if self._broken:
... | python | def _readall(self, size):
"""
Read until all bytes are collected.
Parameters
----------
size : int
Number of bytes to read.
"""
data = b""
while len(data) < size:
d = self._read(size - len(data))
if self._broken:
... | Read until all bytes are collected.
Parameters
----------
size : int
Number of bytes to read. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/framer.py#L94-L115 |
swift-nav/libsbp | python/sbp/client/framer.py | Framer._receive | def _receive(self):
"""
Read and build SBP message.
"""
# preamble - not readall(1) to allow breaking before messages,
# empty input
preamble = self._read(1)
if not preamble:
return None
elif ord(preamble) != SBP_PREAMBLE:
if self._... | python | def _receive(self):
"""
Read and build SBP message.
"""
# preamble - not readall(1) to allow breaking before messages,
# empty input
preamble = self._read(1)
if not preamble:
return None
elif ord(preamble) != SBP_PREAMBLE:
if self._... | Read and build SBP message. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/framer.py#L117-L149 |
swift-nav/libsbp | python/sbp/table.py | dispatch | def dispatch(msg, table=_SBP_TABLE):
"""
Dispatch an SBP message type based on its `msg_type` and parse its
payload.
Parameters
----------
driver : :class:`SBP`
A parsed SBP object.
table : dict
Any table mapping unique SBP message type IDs to SBP message
constructors.
Returns
----------... | python | def dispatch(msg, table=_SBP_TABLE):
"""
Dispatch an SBP message type based on its `msg_type` and parse its
payload.
Parameters
----------
driver : :class:`SBP`
A parsed SBP object.
table : dict
Any table mapping unique SBP message type IDs to SBP message
constructors.
Returns
----------... | Dispatch an SBP message type based on its `msg_type` and parse its
payload.
Parameters
----------
driver : :class:`SBP`
A parsed SBP object.
table : dict
Any table mapping unique SBP message type IDs to SBP message
constructors.
Returns
----------
SBP message with a parsed payload. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/table.py#L70-L98 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler._recv_thread | def _recv_thread(self):
"""
Internal thread to iterate over source messages and dispatch callbacks.
"""
for msg, metadata in self._source:
if msg.msg_type:
self._call(msg, **metadata)
# Break any upstream iterators
for sink in self._sinks:
... | python | def _recv_thread(self):
"""
Internal thread to iterate over source messages and dispatch callbacks.
"""
for msg, metadata in self._source:
if msg.msg_type:
self._call(msg, **metadata)
# Break any upstream iterators
for sink in self._sinks:
... | Internal thread to iterate over source messages and dispatch callbacks. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L52-L64 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler.filter | def filter(self, msg_type=None, maxsize=0):
"""
Get a filtered iterator of messages for synchronous, blocking use in
another thread.
"""
if self._dead:
return iter(())
iterator = Handler._SBPQueueIterator(maxsize)
# We use a weakref so that the iterato... | python | def filter(self, msg_type=None, maxsize=0):
"""
Get a filtered iterator of messages for synchronous, blocking use in
another thread.
"""
if self._dead:
return iter(())
iterator = Handler._SBPQueueIterator(maxsize)
# We use a weakref so that the iterato... | Get a filtered iterator of messages for synchronous, blocking use in
another thread. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L79-L100 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler.add_callback | def add_callback(self, callback, msg_type=None):
"""
Add per message type or global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means global callba... | python | def add_callback(self, callback, msg_type=None):
"""
Add per message type or global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means global callba... | Add per message type or global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means global callback.
Iterable type adds the callback to all the message type... | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L115-L132 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler.remove_callback | def remove_callback(self, callback, msg_type=None):
"""
Remove per message type of global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to remove callback from. Default `None` means global callb... | python | def remove_callback(self, callback, msg_type=None):
"""
Remove per message type of global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to remove callback from. Default `None` means global callb... | Remove per message type of global callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to remove callback from. Default `None` means global callback.
Iterable type removes the callback from all the message t... | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L134-L156 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler._gc_dead_sinks | def _gc_dead_sinks(self):
"""
Remove any dead weakrefs.
"""
deadsinks = []
for i in self._sinks:
if i() is None:
deadsinks.append(i)
for i in deadsinks:
self._sinks.remove(i) | python | def _gc_dead_sinks(self):
"""
Remove any dead weakrefs.
"""
deadsinks = []
for i in self._sinks:
if i() is None:
deadsinks.append(i)
for i in deadsinks:
self._sinks.remove(i) | Remove any dead weakrefs. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L158-L167 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler._call | def _call(self, msg, **metadata):
"""
Process message with all callbacks (global and per message type).
"""
if msg.msg_type:
for callback in self._get_callbacks(msg.msg_type):
try:
callback(msg, **metadata)
except Handler._D... | python | def _call(self, msg, **metadata):
"""
Process message with all callbacks (global and per message type).
"""
if msg.msg_type:
for callback in self._get_callbacks(msg.msg_type):
try:
callback(msg, **metadata)
except Handler._D... | Process message with all callbacks (global and per message type). | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L180-L197 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler.wait | def wait(self, msg_type, timeout=1.0):
"""
Wait for a SBP message.
Parameters
----------
msg_type : int
SBP message type.
timeout : float
Waiting period
"""
event = threading.Event()
payload = {'data': None}
def cb(sbp... | python | def wait(self, msg_type, timeout=1.0):
"""
Wait for a SBP message.
Parameters
----------
msg_type : int
SBP message type.
timeout : float
Waiting period
"""
event = threading.Event()
payload = {'data': None}
def cb(sbp... | Wait for a SBP message.
Parameters
----------
msg_type : int
SBP message type.
timeout : float
Waiting period | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L221-L242 |
swift-nav/libsbp | python/sbp/client/handler.py | Handler.wait_callback | def wait_callback(self, callback, msg_type=None, timeout=1.0):
"""
Wait for a SBP message with a callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means ... | python | def wait_callback(self, callback, msg_type=None, timeout=1.0):
"""
Wait for a SBP message with a callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means ... | Wait for a SBP message with a callback.
Parameters
----------
callback : fn
Callback function
msg_type : int | iterable
Message type to register callback against. Default `None` means global callback.
Iterable type adds the callback to all the message types... | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/handler.py#L244-L266 |
swift-nav/libsbp | python/sbp/client/drivers/cdc_driver.py | CdcDriver.read | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read.
"""
try:
return_val = self.handle.read(size)
if return_val == '':
print()
print("Piksi disconnected... | python | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read.
"""
try:
return_val = self.handle.read(size)
if return_val == '':
print()
print("Piksi disconnected... | Read wrapper.
Parameters
----------
size : int
Number of bytes to read. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/cdc_driver.py#L27-L48 |
swift-nav/libsbp | python/sbp/client/drivers/cdc_driver.py | CdcDriver.write | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
return self.handle.write(s)
except OSError:
print()
print("Piksi disconnected")
print()
ra... | python | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
return self.handle.write(s)
except OSError:
print()
print("Piksi disconnected")
print()
ra... | Write wrapper.
Parameters
----------
s : bytes
Bytes to write | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/cdc_driver.py#L50-L65 |
swift-nav/libsbp | generator/sbpg/utils.py | fmt_repr | def fmt_repr(obj):
"""
Return pretty printed string representation of an object.
"""
items = {k: v for k, v in list(obj.__dict__.items())}
return "<%s: {%s}>" % (obj.__class__.__name__, pprint.pformat(items, width=1)) | python | def fmt_repr(obj):
"""
Return pretty printed string representation of an object.
"""
items = {k: v for k, v in list(obj.__dict__.items())}
return "<%s: {%s}>" % (obj.__class__.__name__, pprint.pformat(items, width=1)) | Return pretty printed string representation of an object. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/utils.py#L14-L20 |
swift-nav/libsbp | python/sbp/client/util/settingmonitor.py | SettingMonitor.capture_setting | def capture_setting(self, sbp_msg, **metadata):
"""Callback to extract and store setting values from
SBP_MSG_SETTINGS_READ_RESP
Messages of any type other than SBP_MSG_SETTINGS_READ_RESP are ignored
"""
if sbp_msg.msg_type == SBP_MSG_SETTINGS_READ_RESP:
section, sett... | python | def capture_setting(self, sbp_msg, **metadata):
"""Callback to extract and store setting values from
SBP_MSG_SETTINGS_READ_RESP
Messages of any type other than SBP_MSG_SETTINGS_READ_RESP are ignored
"""
if sbp_msg.msg_type == SBP_MSG_SETTINGS_READ_RESP:
section, sett... | Callback to extract and store setting values from
SBP_MSG_SETTINGS_READ_RESP
Messages of any type other than SBP_MSG_SETTINGS_READ_RESP are ignored | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/util/settingmonitor.py#L32-L40 |
swift-nav/libsbp | python/sbp/client/util/settingmonitor.py | SettingMonitor.wait_for_setting_value | def wait_for_setting_value(self, section, setting, value, wait_time=5.0):
"""Function to wait wait_time seconds to see a
SBP_MSG_SETTINGS_READ_RESP message with a user-specified value
"""
expire = time.time() + wait_time
ok = False
while not ok and time.time() < expire:
... | python | def wait_for_setting_value(self, section, setting, value, wait_time=5.0):
"""Function to wait wait_time seconds to see a
SBP_MSG_SETTINGS_READ_RESP message with a user-specified value
"""
expire = time.time() + wait_time
ok = False
while not ok and time.time() < expire:
... | Function to wait wait_time seconds to see a
SBP_MSG_SETTINGS_READ_RESP message with a user-specified value | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/util/settingmonitor.py#L42-L55 |
swift-nav/libsbp | python/sbp/client/util/settingmonitor.py | SettingMonitor.clear | def clear(self, section=None, setting=None, value=None):
"""Clear settings"""
match = [all((section is None or x_y_z[0] == section,
setting is None or x_y_z[1] == setting,
value is None or x_y_z[2] == value)) for x_y_z in self.settings]
keep = [settin... | python | def clear(self, section=None, setting=None, value=None):
"""Clear settings"""
match = [all((section is None or x_y_z[0] == section,
setting is None or x_y_z[1] == setting,
value is None or x_y_z[2] == value)) for x_y_z in self.settings]
keep = [settin... | Clear settings | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/util/settingmonitor.py#L57-L65 |
swift-nav/libsbp | generator/sbpg/targets/python.py | construct_format | def construct_format(f, type_map=CONSTRUCT_CODE):
"""
Formats for Construct.
"""
formatted = ""
if type_map.get(f.type_id, None):
return "'{identifier}' / {type_id}".format(type_id=type_map.get(f.type_id),
identifier=f.identifier)
elif f.type_id == 'string' a... | python | def construct_format(f, type_map=CONSTRUCT_CODE):
"""
Formats for Construct.
"""
formatted = ""
if type_map.get(f.type_id, None):
return "'{identifier}' / {type_id}".format(type_id=type_map.get(f.type_id),
identifier=f.identifier)
elif f.type_id == 'string' a... | Formats for Construct. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/python.py#L57-L83 |
swift-nav/libsbp | generator/sbpg/targets/python.py | render_source | def render_source(output_dir, package_spec, jenv=JENV):
"""
Render and output
"""
path, name = package_spec.filepath
directory = output_dir
destination_filename = "%s/%s.py" % (directory, name)
py_template = jenv.get_template(TEMPLATE_NAME)
module_path = ".".join(package_spec.identifier.split(".")[1:-1]... | python | def render_source(output_dir, package_spec, jenv=JENV):
"""
Render and output
"""
path, name = package_spec.filepath
directory = output_dir
destination_filename = "%s/%s.py" % (directory, name)
py_template = jenv.get_template(TEMPLATE_NAME)
module_path = ".".join(package_spec.identifier.split(".")[1:-1]... | Render and output | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/python.py#L105-L123 |
swift-nav/libsbp | python/sbp/client/drivers/network_drivers.py | TCPDriver.read | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read
"""
data = None
while True:
try:
data = self.handle.recv(size)
except socket.timeout as socket_error:
... | python | def read(self, size):
"""
Read wrapper.
Parameters
----------
size : int
Number of bytes to read
"""
data = None
while True:
try:
data = self.handle.recv(size)
except socket.timeout as socket_error:
... | Read wrapper.
Parameters
----------
size : int
Number of bytes to read | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/network_drivers.py#L81-L104 |
swift-nav/libsbp | python/sbp/client/drivers/network_drivers.py | TCPDriver.write | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
self._write_lock.acquire()
self.handle.sendall(s)
except socket.timeout:
self._connect()
except socket.err... | python | def write(self, s):
"""
Write wrapper.
Parameters
----------
s : bytes
Bytes to write
"""
try:
self._write_lock.acquire()
self.handle.sendall(s)
except socket.timeout:
self._connect()
except socket.err... | Write wrapper.
Parameters
----------
s : bytes
Bytes to write | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/client/drivers/network_drivers.py#L109-L126 |
swift-nav/libsbp | python/sbp/utils.py | exclude_fields | def exclude_fields(obj, exclude=EXCLUDE):
"""
Return dict of object without parent attrs.
"""
return dict([(k, getattr(obj, k)) for k in obj.__slots__ if k not in exclude]) | python | def exclude_fields(obj, exclude=EXCLUDE):
"""
Return dict of object without parent attrs.
"""
return dict([(k, getattr(obj, k)) for k in obj.__slots__ if k not in exclude]) | Return dict of object without parent attrs. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/utils.py#L21-L25 |
swift-nav/libsbp | python/sbp/utils.py | walk_json_dict | def walk_json_dict(coll):
"""
Flatten a parsed SBP object into a dicts and lists, which are
compatible for JSON output.
Parameters
----------
coll : dict
"""
if isinstance(coll, dict):
return dict((k, walk_json_dict(v)) for (k, v) in iter(coll.items()))
elif isinstance(coll, bytes):
return c... | python | def walk_json_dict(coll):
"""
Flatten a parsed SBP object into a dicts and lists, which are
compatible for JSON output.
Parameters
----------
coll : dict
"""
if isinstance(coll, dict):
return dict((k, walk_json_dict(v)) for (k, v) in iter(coll.items()))
elif isinstance(coll, bytes):
return c... | Flatten a parsed SBP object into a dicts and lists, which are
compatible for JSON output.
Parameters
----------
coll : dict | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/utils.py#L28-L45 |
swift-nav/libsbp | python/sbp/utils.py | containerize | def containerize(coll):
"""Walk attribute fields passed from an SBP message and convert to
Containers where appropriate. Needed for Construct proper
serialization.
Parameters
----------
coll : dict
"""
if isinstance(coll, Container):
[setattr(coll, k, containerize(v)) for (k, v) in coll.items()]
... | python | def containerize(coll):
"""Walk attribute fields passed from an SBP message and convert to
Containers where appropriate. Needed for Construct proper
serialization.
Parameters
----------
coll : dict
"""
if isinstance(coll, Container):
[setattr(coll, k, containerize(v)) for (k, v) in coll.items()]
... | Walk attribute fields passed from an SBP message and convert to
Containers where appropriate. Needed for Construct proper
serialization.
Parameters
----------
coll : dict | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/utils.py#L48-L69 |
swift-nav/libsbp | python/sbp/utils.py | fmt_repr | def fmt_repr(obj):
"""Print a orphaned string representation of an object without the
clutter of its parent object.
"""
items = ["%s = %r" % (k, v) for k, v in list(exclude_fields(obj).items())]
return "<%s: {%s}>" % (obj.__class__.__name__, ', '.join(items)) | python | def fmt_repr(obj):
"""Print a orphaned string representation of an object without the
clutter of its parent object.
"""
items = ["%s = %r" % (k, v) for k, v in list(exclude_fields(obj).items())]
return "<%s: {%s}>" % (obj.__class__.__name__, ', '.join(items)) | Print a orphaned string representation of an object without the
clutter of its parent object. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/python/sbp/utils.py#L72-L78 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | read_spec | def read_spec(filename, verbose=False):
"""
Read an SBP specification.
Parameters
----------
filename : str
Local filename for specification.
verbose : bool
Print out some debugging info
Returns
----------
Raises
----------
Exception
On empty file.
yaml.YAMLError
On Yaml parsi... | python | def read_spec(filename, verbose=False):
"""
Read an SBP specification.
Parameters
----------
filename : str
Local filename for specification.
verbose : bool
Print out some debugging info
Returns
----------
Raises
----------
Exception
On empty file.
yaml.YAMLError
On Yaml parsi... | Read an SBP specification.
Parameters
----------
filename : str
Local filename for specification.
verbose : bool
Print out some debugging info
Returns
----------
Raises
----------
Exception
On empty file.
yaml.YAMLError
On Yaml parsing error
voluptuous.Invalid
On invalid SBP... | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L32-L65 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | get_files | def get_files(input_file):
"""
Initializes an index of files to generate, returns the base
directory and index.
"""
file_index = {}
base_dir = None
if os.path.isfile(input_file):
file_index[input_file] = None
base_dir = os.path.dirname(input_file)
elif os.path.isdir(input_file):
base_dir = ... | python | def get_files(input_file):
"""
Initializes an index of files to generate, returns the base
directory and index.
"""
file_index = {}
base_dir = None
if os.path.isfile(input_file):
file_index[input_file] = None
base_dir = os.path.dirname(input_file)
elif os.path.isdir(input_file):
base_dir = ... | Initializes an index of files to generate, returns the base
directory and index. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L102-L122 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | resolve_deps | def resolve_deps(base_dir, file_index):
"""
Given a base directory and an initial set of files, retrieves
dependencies and adds them to the file_index.
"""
def flatten(tree, index = {}):
for include in tree.get('include', []):
fname = base_dir + "/" + include
assert os.path.exists(fname), "Fi... | python | def resolve_deps(base_dir, file_index):
"""
Given a base directory and an initial set of files, retrieves
dependencies and adds them to the file_index.
"""
def flatten(tree, index = {}):
for include in tree.get('include', []):
fname = base_dir + "/" + include
assert os.path.exists(fname), "Fi... | Given a base directory and an initial set of files, retrieves
dependencies and adds them to the file_index. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L146-L163 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | mk_package | def mk_package(contents):
"""Instantiates a package specification from a parsed "AST" of a
package.
Parameters
----------
contents : dict
Returns
----------
PackageSpecification
"""
package = contents.get('package', None)
description = contents.get('description', None)
include = contents.get(... | python | def mk_package(contents):
"""Instantiates a package specification from a parsed "AST" of a
package.
Parameters
----------
contents : dict
Returns
----------
PackageSpecification
"""
package = contents.get('package', None)
description = contents.get('description', None)
include = contents.get(... | Instantiates a package specification from a parsed "AST" of a
package.
Parameters
----------
contents : dict
Returns
----------
PackageSpecification | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L216-L240 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | mk_definition | def mk_definition(defn):
"""Instantiates a struct or SBP message specification from a parsed
"AST" of a struct or message.
Parameters
----------
defn : dict
Returns
----------
A Definition or a specialization of a definition, like a Struct
"""
assert len(defn) == 1
identifier, contents = next(i... | python | def mk_definition(defn):
"""Instantiates a struct or SBP message specification from a parsed
"AST" of a struct or message.
Parameters
----------
defn : dict
Returns
----------
A Definition or a specialization of a definition, like a Struct
"""
assert len(defn) == 1
identifier, contents = next(i... | Instantiates a struct or SBP message specification from a parsed
"AST" of a struct or message.
Parameters
----------
defn : dict
Returns
----------
A Definition or a specialization of a definition, like a Struct | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L241-L263 |
swift-nav/libsbp | generator/sbpg/specs/yaml2.py | mk_field | def mk_field(field):
"""Instantiates a field specification from a parsed "AST" of a
field.
Parameters
----------
field : dict
Returns
----------
A Field or a specialization of a field, like a bitfield.
"""
assert len(field) == 1
identifier, contents = next(iter(field.items()))
contents = dict... | python | def mk_field(field):
"""Instantiates a field specification from a parsed "AST" of a
field.
Parameters
----------
field : dict
Returns
----------
A Field or a specialization of a field, like a bitfield.
"""
assert len(field) == 1
identifier, contents = next(iter(field.items()))
contents = dict... | Instantiates a field specification from a parsed "AST" of a
field.
Parameters
----------
field : dict
Returns
----------
A Field or a specialization of a field, like a bitfield. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/specs/yaml2.py#L265-L283 |
swift-nav/libsbp | generator/sbpg/targets/haskell.py | to_global | def to_global(s):
"""
Format a global variable name.
"""
if s.startswith('GPSTime'):
s = 'Gps' + s[3:]
if '_' in s:
s = "".join([i.capitalize() for i in s.split("_")])
return s[0].lower() + s[1:] | python | def to_global(s):
"""
Format a global variable name.
"""
if s.startswith('GPSTime'):
s = 'Gps' + s[3:]
if '_' in s:
s = "".join([i.capitalize() for i in s.split("_")])
return s[0].lower() + s[1:] | Format a global variable name. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/haskell.py#L73-L82 |
swift-nav/libsbp | generator/sbpg/targets/haskell.py | to_data | def to_data(s):
"""
Format a data variable name.
"""
if s.startswith('GPSTime'):
s = 'Gps' + s[3:]
if '_' in s:
return "".join([i.capitalize() for i in s.split("_")])
return s | python | def to_data(s):
"""
Format a data variable name.
"""
if s.startswith('GPSTime'):
s = 'Gps' + s[3:]
if '_' in s:
return "".join([i.capitalize() for i in s.split("_")])
return s | Format a data variable name. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/haskell.py#L84-L93 |
swift-nav/libsbp | generator/sbpg/targets/haskell.py | to_type | def to_type(f, type_map=CONSTRUCT_CODE):
"""
Format a the proper type.
"""
name = f.type_id
if name.startswith('GPSTime'):
name = 'Gps' + name[3:]
if type_map.get(name, None):
return type_map.get(name, None)
elif name == 'array':
fill = f.options['fill'].value
f_ = copy.copy(f)
f_.type... | python | def to_type(f, type_map=CONSTRUCT_CODE):
"""
Format a the proper type.
"""
name = f.type_id
if name.startswith('GPSTime'):
name = 'Gps' + name[3:]
if type_map.get(name, None):
return type_map.get(name, None)
elif name == 'array':
fill = f.options['fill'].value
f_ = copy.copy(f)
f_.type... | Format a the proper type. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/haskell.py#L95-L109 |
swift-nav/libsbp | generator/sbpg/targets/haskell.py | render_source | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
module_prefix = "SwiftNav.SBP"
module_name = camel_case(name)
full_module_name = ".".join([module_prefix, module_name])
destination_filename = "%s/src/S... | python | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
module_prefix = "SwiftNav.SBP"
module_name = camel_case(name)
full_module_name = ".".join([module_prefix, module_name])
destination_filename = "%s/src/S... | Render and output to a directory given a package specification. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/haskell.py#L164-L181 |
swift-nav/libsbp | generator/sbpg/targets/protobuf.py | to_comment | def to_comment(value):
"""
Builds a comment.
"""
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | python | def to_comment(value):
"""
Builds a comment.
"""
if value is None:
return
if len(value.split('\n')) == 1:
return "* " + value
else:
return '\n'.join([' * ' + l for l in value.split('\n')[:-1]]) | Builds a comment. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/protobuf.py#L39-L48 |
swift-nav/libsbp | generator/sbpg/targets/protobuf.py | to_identifier | def to_identifier(s):
"""
Convert snake_case to camel_case.
"""
if s.startswith('GPS'):
s = 'Gps' + s[3:]
return ''.join([i.capitalize() for i in s.split('_')]) if '_' in s else s | python | def to_identifier(s):
"""
Convert snake_case to camel_case.
"""
if s.startswith('GPS'):
s = 'Gps' + s[3:]
return ''.join([i.capitalize() for i in s.split('_')]) if '_' in s else s | Convert snake_case to camel_case. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/protobuf.py#L50-L56 |
swift-nav/libsbp | generator/sbpg/targets/protobuf.py | render_source | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
destination_filename = '%s/%s.proto' % (output_dir, name)
pb_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)
includes = [include[:-5] i... | python | def render_source(output_dir, package_spec):
"""
Render and output to a directory given a package specification.
"""
path, name = package_spec.filepath
destination_filename = '%s/%s.proto' % (output_dir, name)
pb_template = JENV.get_template(MESSAGES_TEMPLATE_NAME)
includes = [include[:-5] i... | Render and output to a directory given a package specification. | https://github.com/swift-nav/libsbp/blob/5a950608506b23e31b73ef7065da905b646055c1/generator/sbpg/targets/protobuf.py#L81-L98 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp_container_functions.py | load_app_resource | def load_app_resource(**kwargs):
'''
:param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_RESOURCES_ID" or "DX_PROJECT_CONTEXT_... | python | def load_app_resource(**kwargs):
'''
:param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_RESOURCES_ID" or "DX_PROJECT_CONTEXT_... | :param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_RESOURCES_ID" or "DX_PROJECT_CONTEXT_ID" is not found in the environment variables... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp_container_functions.py#L34-L62 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp_container_functions.py | load_from_cache | def load_from_cache(**kwargs):
'''
:param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the e... | python | def load_from_cache(**kwargs):
'''
:param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the e... | :param kwargs: keyword args for :func:`~dxpy.bindings.search.find_one_data_object`, with the exception of "project"
:raises: :exc:`~dxpy.exceptions.DXError` if "project" is given, if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the environment variables
:returns: None if ... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp_container_functions.py#L64-L100 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapp_container_functions.py | save_to_cache | def save_to_cache(dxobject):
'''
:param dxobject: a dxpy object handler for an object to save to the cache
:raises: :exc:`~dxpy.exceptions.DXError` if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the environment variables
Clones the given object to the project ca... | python | def save_to_cache(dxobject):
'''
:param dxobject: a dxpy object handler for an object to save to the cache
:raises: :exc:`~dxpy.exceptions.DXError` if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the environment variables
Clones the given object to the project ca... | :param dxobject: a dxpy object handler for an object to save to the cache
:raises: :exc:`~dxpy.exceptions.DXError` if this is called with dxpy.JOB_ID not set, or if "DX_PROJECT_CACHE_ID" is not found in the environment variables
Clones the given object to the project cache.
Example::
@dxpy.entry_... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapp_container_functions.py#L103-L125 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapplet.py | DXExecutable._get_run_input_common_fields | def _get_run_input_common_fields(executable_input, **kwargs):
'''
Takes the same arguments as the run method. Creates an input hash for the /executable-xxxx/run method,
translating ONLY the fields that can be handled uniformly across all executables: project, folder, name, tags,
properti... | python | def _get_run_input_common_fields(executable_input, **kwargs):
'''
Takes the same arguments as the run method. Creates an input hash for the /executable-xxxx/run method,
translating ONLY the fields that can be handled uniformly across all executables: project, folder, name, tags,
properti... | Takes the same arguments as the run method. Creates an input hash for the /executable-xxxx/run method,
translating ONLY the fields that can be handled uniformly across all executables: project, folder, name, tags,
properties, details, depends_on, allow_ssh, debug, delay_workspace_destruction, ignore_reu... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapplet.py#L46-L100 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapplet.py | DXExecutable._get_run_input_fields_for_applet | def _get_run_input_fields_for_applet(executable_input, **kwargs):
'''
Takes the same arguments as the run method. Creates an input
hash for the /applet-xxxx/run method.
'''
# Although it says "for_applet", this is factored out of
# DXApplet because apps currently use the ... | python | def _get_run_input_fields_for_applet(executable_input, **kwargs):
'''
Takes the same arguments as the run method. Creates an input
hash for the /applet-xxxx/run method.
'''
# Although it says "for_applet", this is factored out of
# DXApplet because apps currently use the ... | Takes the same arguments as the run method. Creates an input
hash for the /applet-xxxx/run method. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapplet.py#L103-L114 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapplet.py | DXExecutable.run | def run(self, executable_input, project=None, folder=None, name=None, tags=None, properties=None, details=None,
instance_type=None, stage_instance_types=None, stage_folders=None, rerun_stages=None, cluster_spec=None,
depends_on=None, allow_ssh=None, debug=None, delay_workspace_destruction=None, ... | python | def run(self, executable_input, project=None, folder=None, name=None, tags=None, properties=None, details=None,
instance_type=None, stage_instance_types=None, stage_folders=None, rerun_stages=None, cluster_spec=None,
depends_on=None, allow_ssh=None, debug=None, delay_workspace_destruction=None, ... | :param executable_input: Hash of the executable's input arguments
:type executable_input: dict
:param project: Project ID of the project context
:type project: string
:param folder: Folder in which executable's outputs will be placed in *project*
:type folder: string
:par... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapplet.py#L158-L227 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapplet.py | DXApplet._new | def _new(self, dx_hash, **kwargs):
'''
:param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param runSpec: Run specification
:type runSpec: dict
:param dxapi: API ... | python | def _new(self, dx_hash, **kwargs):
'''
:param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param runSpec: Run specification
:type runSpec: dict
:param dxapi: API ... | :param dx_hash: Standard hash populated in :func:`dxpy.bindings.DXDataObject.new()` containing attributes common to all data object classes.
:type dx_hash: dict
:param runSpec: Run specification
:type runSpec: dict
:param dxapi: API version string
:type dxapi: string
:par... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapplet.py#L307-L351 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxapplet.py | DXApplet.run | def run(self, applet_input, *args, **kwargs):
"""
Creates a new job that executes the function "main" of this applet with
the given input *applet_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args.
"""
# Rename applet_input arg to ... | python | def run(self, applet_input, *args, **kwargs):
"""
Creates a new job that executes the function "main" of this applet with
the given input *applet_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args.
"""
# Rename applet_input arg to ... | Creates a new job that executes the function "main" of this applet with
the given input *applet_input*.
See :meth:`dxpy.bindings.dxapplet.DXExecutable.run` for the available
args. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxapplet.py#L384-L394 |
dnanexus/dx-toolkit | src/python/dxpy/cli/parsers.py | set_env_from_args | def set_env_from_args(args):
''' Sets the environment variables for this process from arguments (argparse.Namespace)
and calls dxpy._initialize() to reset any values that it has already set.
'''
args = vars(args)
if args.get('apiserver_host') is not None:
config['DX_APISERVER_HOST'] = args[... | python | def set_env_from_args(args):
''' Sets the environment variables for this process from arguments (argparse.Namespace)
and calls dxpy._initialize() to reset any values that it has already set.
'''
args = vars(args)
if args.get('apiserver_host') is not None:
config['DX_APISERVER_HOST'] = args[... | Sets the environment variables for this process from arguments (argparse.Namespace)
and calls dxpy._initialize() to reset any values that it has already set. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/cli/parsers.py#L186-L208 |
dnanexus/dx-toolkit | src/python/dxpy/asset_builder.py | validate_conf | def validate_conf(asset_conf):
"""
Validates the contents of the conf file and makes sure that the required information
is provided.
{
"name": "asset_library_name",
"title": "A human readable name",
"description": " A detailed description abput the asset",
... | python | def validate_conf(asset_conf):
"""
Validates the contents of the conf file and makes sure that the required information
is provided.
{
"name": "asset_library_name",
"title": "A human readable name",
"description": " A detailed description abput the asset",
... | Validates the contents of the conf file and makes sure that the required information
is provided.
{
"name": "asset_library_name",
"title": "A human readable name",
"description": " A detailed description abput the asset",
"version": "0.0.1",
"distr... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/asset_builder.py#L59-L97 |
dnanexus/dx-toolkit | src/python/dxpy/asset_builder.py | get_asset_tarball | def get_asset_tarball(asset_name, src_dir, dest_project, dest_folder, json_out):
"""
If the src_dir contains a "resources" directory its contents are archived and
the archived file is uploaded to the platform
"""
if os.path.isdir(os.path.join(src_dir, "resources")):
temp_dir = tempfile.mkdte... | python | def get_asset_tarball(asset_name, src_dir, dest_project, dest_folder, json_out):
"""
If the src_dir contains a "resources" directory its contents are archived and
the archived file is uploaded to the platform
"""
if os.path.isdir(os.path.join(src_dir, "resources")):
temp_dir = tempfile.mkdte... | If the src_dir contains a "resources" directory its contents are archived and
the archived file is uploaded to the platform | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/asset_builder.py#L145-L159 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | pick | def pick(choices, default=None, str_choices=None, prompt=None, allow_mult=False, more_choices=False):
'''
:param choices: Strings between which the user will make a choice
:type choices: list of strings
:param default: Number the index to be used as the default
:type default: int or None
:param ... | python | def pick(choices, default=None, str_choices=None, prompt=None, allow_mult=False, more_choices=False):
'''
:param choices: Strings between which the user will make a choice
:type choices: list of strings
:param default: Number the index to be used as the default
:type default: int or None
:param ... | :param choices: Strings between which the user will make a choice
:type choices: list of strings
:param default: Number the index to be used as the default
:type default: int or None
:param str_choices: Strings to be used as aliases for the choices; must be of the same length as choices and each string ... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L36-L99 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | object_exists_in_project | def object_exists_in_project(obj_id, proj_id):
'''
:param obj_id: object ID
:type obj_id: str
:param proj_id: project ID
:type proj_id: str
Returns True if the specified data object can be found in the specified
project.
'''
if obj_id is None:
raise ValueError("Expected obj_... | python | def object_exists_in_project(obj_id, proj_id):
'''
:param obj_id: object ID
:type obj_id: str
:param proj_id: project ID
:type proj_id: str
Returns True if the specified data object can be found in the specified
project.
'''
if obj_id is None:
raise ValueError("Expected obj_... | :param obj_id: object ID
:type obj_id: str
:param proj_id: project ID
:type proj_id: str
Returns True if the specified data object can be found in the specified
project. | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L195-L211 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | get_last_pos_of_char | def get_last_pos_of_char(char, string):
'''
:param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
... | python | def get_last_pos_of_char(char, string):
'''
:param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
... | :param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
Finds the last occurrence of *char* in *string* i... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L233-L258 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | get_first_pos_of_char | def get_first_pos_of_char(char, string):
'''
:param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
... | python | def get_first_pos_of_char(char, string):
'''
:param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
... | :param char: The character to find
:type char: string
:param string: The string in which to search for *char*
:type string: string
:returns: Index in *string* where *char* last appears (unescaped by a preceding "\\"), -1 if not found
:rtype: int
Finds the first occurrence of *char* in *string* ... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L260-L286 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | split_unescaped | def split_unescaped(char, string, include_empty_strings=False):
'''
:param char: The character on which to split the string
:type char: string
:param string: The string to split
:type string: string
:returns: List of substrings of *string*
:rtype: list of strings
Splits *string* wheneve... | python | def split_unescaped(char, string, include_empty_strings=False):
'''
:param char: The character on which to split the string
:type char: string
:param string: The string to split
:type string: string
:returns: List of substrings of *string*
:rtype: list of strings
Splits *string* wheneve... | :param char: The character on which to split the string
:type char: string
:param string: The string to split
:type string: string
:returns: List of substrings of *string*
:rtype: list of strings
Splits *string* whenever *char* appears without an odd number of
backslashes ('\\') preceding i... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L288-L314 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | clean_folder_path | def clean_folder_path(path, expected=None):
'''
:param path: A folder path to sanitize and parse
:type path: string
:param expected: Whether a folder ("folder"), a data object ("entity"), or either (None) is expected
:type expected: string or None
:returns: *folderpath*, *name*
Unescape and... | python | def clean_folder_path(path, expected=None):
'''
:param path: A folder path to sanitize and parse
:type path: string
:param expected: Whether a folder ("folder"), a data object ("entity"), or either (None) is expected
:type expected: string or None
:returns: *folderpath*, *name*
Unescape and... | :param path: A folder path to sanitize and parse
:type path: string
:param expected: Whether a folder ("folder"), a data object ("entity"), or either (None) is expected
:type expected: string or None
:returns: *folderpath*, *name*
Unescape and parse *path* as a folder path to possibly an entity
... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L317-L354 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_container_id_or_name | def resolve_container_id_or_name(raw_string, is_error=False, multi=False):
'''
:param raw_string: A potential project or container ID or name
:type raw_string: string
:param is_error: Whether to raise an exception if the project or
container ID cannot be resolved
:type is_error: boolean
... | python | def resolve_container_id_or_name(raw_string, is_error=False, multi=False):
'''
:param raw_string: A potential project or container ID or name
:type raw_string: string
:param is_error: Whether to raise an exception if the project or
container ID cannot be resolved
:type is_error: boolean
... | :param raw_string: A potential project or container ID or name
:type raw_string: string
:param is_error: Whether to raise an exception if the project or
container ID cannot be resolved
:type is_error: boolean
:returns: Project or container ID if found or else None
:rtype: string or None
... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L357-L402 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_path | def resolve_path(path, expected=None, multi_projects=False, allow_empty_string=True):
'''
:param path: A path to a data object to attempt to resolve
:type path: string
:param expected: one of the following: "folder", "entity", or None
to indicate whether the expected path is a folder, a data... | python | def resolve_path(path, expected=None, multi_projects=False, allow_empty_string=True):
'''
:param path: A path to a data object to attempt to resolve
:type path: string
:param expected: one of the following: "folder", "entity", or None
to indicate whether the expected path is a folder, a data... | :param path: A path to a data object to attempt to resolve
:type path: string
:param expected: one of the following: "folder", "entity", or None
to indicate whether the expected path is a folder, a data
object, or either
:type expected: string or None
:returns: A tuple of 3 value... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L420-L557 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | _check_resolution_needed | def _check_resolution_needed(path, project, folderpath, entity_name, expected_classes=None, describe=True,
enclose_in_list=False):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: T... | python | def _check_resolution_needed(path, project, folderpath, entity_name, expected_classes=None, describe=True,
enclose_in_list=False):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: T... | :param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: The potential project the entity belongs to
:type project: string
:param folderpath: Path to the entity
:type folderpath: string
:param entity_name: The name... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L615-L718 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | _resolve_folder | def _resolve_folder(project, parent_folder, folder_name):
"""
:param project: The project that the folder belongs to
:type project: string
:param parent_folder: Full path to the parent folder that contains
folder_name
:type parent_folder: string
:param folder_name: Name ... | python | def _resolve_folder(project, parent_folder, folder_name):
"""
:param project: The project that the folder belongs to
:type project: string
:param parent_folder: Full path to the parent folder that contains
folder_name
:type parent_folder: string
:param folder_name: Name ... | :param project: The project that the folder belongs to
:type project: string
:param parent_folder: Full path to the parent folder that contains
folder_name
:type parent_folder: string
:param folder_name: Name of the folder
:type folder_name: string
:returns: The path to ... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L721-L747 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | _validate_resolution_output_length | def _validate_resolution_output_length(path, entity_name, results, allow_mult=False, all_mult=False,
ask_to_resolve=True):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param entity_n... | python | def _validate_resolution_output_length(path, entity_name, results, allow_mult=False, all_mult=False,
ask_to_resolve=True):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param entity_n... | :param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param entity_name: Name of the object
:type entity_name: string
:param results: Result of resolution; non-empty list of object
specifications (each specificatio... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L750-L828 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | _resolve_global_entity | def _resolve_global_entity(project_or_job_id, folderpath, entity_name, describe=True, visibility="either"):
"""
:param project_or_job_id: The project ID to which the entity belongs
(then the entity is an existing data object),
or the job ID to which th... | python | def _resolve_global_entity(project_or_job_id, folderpath, entity_name, describe=True, visibility="either"):
"""
:param project_or_job_id: The project ID to which the entity belongs
(then the entity is an existing data object),
or the job ID to which th... | :param project_or_job_id: The project ID to which the entity belongs
(then the entity is an existing data object),
or the job ID to which the entity belongs
(then the entity is a job-based object
refe... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L831-L888 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | _format_resolution_output | def _format_resolution_output(path, project, folderpath, entity_name, result):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: The potential project the entity belongs to
:type project: string
:param f... | python | def _format_resolution_output(path, project, folderpath, entity_name, result):
"""
:param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: The potential project the entity belongs to
:type project: string
:param f... | :param path: Path to the object that required resolution; propagated from
command-line
:type path: string
:param project: The potential project the entity belongs to
:type project: string
:param folderpath: Path to the entity
:type folderpath: string
:param entity_name: The name... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L891-L933 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_multiple_existing_paths | def resolve_multiple_existing_paths(paths):
"""
:param paths: A list of paths to items that need to be resolved
:type paths: list
:returns: A dictionary mapping a specified path to either its resolved
object or Nones, if the object could not be resolved
:rtype: dict
For each input... | python | def resolve_multiple_existing_paths(paths):
"""
:param paths: A list of paths to items that need to be resolved
:type paths: list
:returns: A dictionary mapping a specified path to either its resolved
object or Nones, if the object could not be resolved
:rtype: dict
For each input... | :param paths: A list of paths to items that need to be resolved
:type paths: list
:returns: A dictionary mapping a specified path to either its resolved
object or Nones, if the object could not be resolved
:rtype: dict
For each input given in paths, attempts to resolve the path, and retur... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L936-L1012 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_existing_path | def resolve_existing_path(path, expected=None, ask_to_resolve=True, expected_classes=None, allow_mult=False,
describe=True, all_mult=False, allow_empty_string=True, visibility="either"):
'''
:param expected: one of the following: "folder", "entity", or None to indicate
... | python | def resolve_existing_path(path, expected=None, ask_to_resolve=True, expected_classes=None, allow_mult=False,
describe=True, all_mult=False, allow_empty_string=True, visibility="either"):
'''
:param expected: one of the following: "folder", "entity", or None to indicate
... | :param expected: one of the following: "folder", "entity", or None to indicate
whether the expected path is a folder, a data object, or either
:type expected: string or None
:param ask_to_resolve: Whether picking may be necessary (if true, a list is returned; if false, only one result is re... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1015-L1084 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | check_folder_exists | def check_folder_exists(project, path, folder_name):
'''
:param project: project id
:type project: string
:param path: path to where we should look for the folder in question
:type path: string
:param folder_name: name of the folder in question
:type folder_name: string
:returns: A boole... | python | def check_folder_exists(project, path, folder_name):
'''
:param project: project id
:type project: string
:param path: path to where we should look for the folder in question
:type path: string
:param folder_name: name of the folder in question
:type folder_name: string
:returns: A boole... | :param project: project id
:type project: string
:param path: path to where we should look for the folder in question
:type path: string
:param folder_name: name of the folder in question
:type folder_name: string
:returns: A boolean True or False whether the folder exists at the specified path
... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1087-L1118 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | get_app_from_path | def get_app_from_path(path):
'''
:param path: A string to attempt to resolve to an app object
:type path: string
:returns: The describe hash of the app object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perhaps refer to
an app object. If... | python | def get_app_from_path(path):
'''
:param path: A string to attempt to resolve to an app object
:type path: string
:returns: The describe hash of the app object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perhaps refer to
an app object. If... | :param path: A string to attempt to resolve to an app object
:type path: string
:returns: The describe hash of the app object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perhaps refer to
an app object. If found, its describe hash will be returne... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1120-L1142 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | get_global_workflow_from_path | def get_global_workflow_from_path(path):
'''
:param path: A string to attempt to resolve to a global workflow object
:type path: string
:returns: The describe hash of the global workflow object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perh... | python | def get_global_workflow_from_path(path):
'''
:param path: A string to attempt to resolve to a global workflow object
:type path: string
:returns: The describe hash of the global workflow object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perh... | :param path: A string to attempt to resolve to a global workflow object
:type path: string
:returns: The describe hash of the global workflow object if found, or None otherwise
:rtype: dict or None
This method parses a string that is expected to perhaps refer to
a global workflow object. If found,... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1144-L1167 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_global_executable | def resolve_global_executable(path, is_version_required=False):
"""
:param path: A string which is supposed to identify a global executable (app or workflow)
:type path: string
:param is_version_required: If set to True, the path has to specify a specific version/alias, e.g. "myapp/1.0.0"
:type is_v... | python | def resolve_global_executable(path, is_version_required=False):
"""
:param path: A string which is supposed to identify a global executable (app or workflow)
:type path: string
:param is_version_required: If set to True, the path has to specify a specific version/alias, e.g. "myapp/1.0.0"
:type is_v... | :param path: A string which is supposed to identify a global executable (app or workflow)
:type path: string
:param is_version_required: If set to True, the path has to specify a specific version/alias, e.g. "myapp/1.0.0"
:type is_version_required: boolean
:returns: The describe hash of the global execu... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1220-L1253 |
dnanexus/dx-toolkit | src/python/dxpy/utils/resolver.py | resolve_to_objects_or_project | def resolve_to_objects_or_project(path, all_matching_results=False):
'''
:param path: Path to resolve
:type path: string
:param all_matching_results: Whether to return a list of all matching results
:type all_matching_results: boolean
A thin wrapper over :meth:`resolve_existing_path` which thro... | python | def resolve_to_objects_or_project(path, all_matching_results=False):
'''
:param path: Path to resolve
:type path: string
:param all_matching_results: Whether to return a list of all matching results
:type all_matching_results: boolean
A thin wrapper over :meth:`resolve_existing_path` which thro... | :param path: Path to resolve
:type path: string
:param all_matching_results: Whether to return a list of all matching results
:type all_matching_results: boolean
A thin wrapper over :meth:`resolve_existing_path` which throws an
error if the path does not look like a project and doesn't match a
... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/utils/resolver.py#L1320-L1346 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxjob.py | new_dxjob | def new_dxjob(fn_input, fn_name, name=None, tags=None, properties=None, details=None,
instance_type=None, depends_on=None,
**kwargs):
'''
:param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: string
:para... | python | def new_dxjob(fn_input, fn_name, name=None, tags=None, properties=None, details=None,
instance_type=None, depends_on=None,
**kwargs):
'''
:param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: string
:para... | :param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: string
:param name: Name for the new job (default is "<parent job name>:<fn_name>")
:type name: string
:param tags: Tags to associate with the job
:type tags: list of strings... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxjob.py#L45-L90 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxjob.py | DXJob.new | def new(self, fn_input, fn_name, name=None, tags=None, properties=None, details=None,
instance_type=None, depends_on=None,
**kwargs):
'''
:param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: ... | python | def new(self, fn_input, fn_name, name=None, tags=None, properties=None, details=None,
instance_type=None, depends_on=None,
**kwargs):
'''
:param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: ... | :param fn_input: Function input
:type fn_input: dict
:param fn_name: Name of the function to be called
:type fn_name: string
:param name: Name for the new job (default is "<parent job name>:<fn_name>")
:type name: string
:param tags: Tags to associate with the job
... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxjob.py#L104-L173 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxjob.py | DXJob.set_id | def set_id(self, dxid):
'''
:param dxid: New job ID to be associated with the handler (localjob IDs also accepted for local runs)
:type dxid: string
Discards the currently stored ID and associates the handler with *dxid*
'''
if dxid is not None:
if not (isins... | python | def set_id(self, dxid):
'''
:param dxid: New job ID to be associated with the handler (localjob IDs also accepted for local runs)
:type dxid: string
Discards the currently stored ID and associates the handler with *dxid*
'''
if dxid is not None:
if not (isins... | :param dxid: New job ID to be associated with the handler (localjob IDs also accepted for local runs)
:type dxid: string
Discards the currently stored ID and associates the handler with *dxid* | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxjob.py#L175-L188 |
dnanexus/dx-toolkit | src/python/dxpy/bindings/dxjob.py | DXJob.describe | def describe(self, fields=None, io=None, **kwargs):
"""
:param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:param io: Include input and output fields... | python | def describe(self, fields=None, io=None, **kwargs):
"""
:param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:param io: Include input and output fields... | :param fields: dict where the keys are field names that should
be returned, and values should be set to True (by default,
all fields are returned)
:type fields: dict
:param io: Include input and output fields in description;
cannot be provided with *fields*; default i... | https://github.com/dnanexus/dx-toolkit/blob/74befb53ad90fcf902d8983ae6d74580f402d619/src/python/dxpy/bindings/dxjob.py#L190-L219 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.