hexsha
stringlengths
40
40
repo
stringlengths
7
114
path
stringlengths
4
124
license
listlengths
1
9
language
stringclasses
1 value
identifier
stringlengths
1
71
return_type
stringlengths
1
749
⌀
original_string
stringlengths
76
22.7k
original_docstring
stringlengths
16
7.61k
docstring
stringlengths
16
2.47k
docstring_tokens
listlengths
6
477
code
stringlengths
14
10.2k
code_tokens
listlengths
6
996
short_docstring
stringlengths
2
644
short_docstring_tokens
listlengths
1
116
comment
listlengths
1
89
parameters
listlengths
0
64
docstring_params
dict
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_validate
null
def _validate(self, writing=False): """ Validate the box before writing to file. """ if self.brand not in ['jp2 ', 'jpx ']: msg = ( f"The file type brand was '{self.brand}'. " f"It should be either 'jp2 ' or 'jpx '." ) ...
Validate the box before writing to file.
Validate the box before writing to file.
[ "Validate", "the", "box", "before", "writing", "to", "file", "." ]
def _validate(self, writing=False): if self.brand not in ['jp2 ', 'jpx ']: msg = ( f"The file type brand was '{self.brand}'. " f"It should be either 'jp2 ' or 'jpx '." ) if writing: raise InvalidJp2kError(msg) else:...
[ "def", "_validate", "(", "self", ",", "writing", "=", "False", ")", ":", "if", "self", ".", "brand", "not", "in", "[", "'jp2 '", ",", "'jpx '", "]", ":", "msg", "=", "(", "f\"The file type brand was '{self.brand}'. \"", "f\"It should be either 'jp2 ' or 'jpx '.\"...
Validate the box before writing to file.
[ "Validate", "the", "box", "before", "writing", "to", "file", "." ]
[ "\"\"\"\n Validate the box before writing to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "writing", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "writing", "type": null, "docstring": null, "docstring_tokens"...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a File Type box to file. """ self._validate(writing=True) length = 16 + 4 * len(self.compatibility_list) fptr.write(struct.pack('>I4s', length, b'ftyp')) fptr.write(self.brand.encode()) fptr.write(struct.pack('>I', self.minor_versio...
Write a File Type box to file.
Write a File Type box to file.
[ "Write", "a", "File", "Type", "box", "to", "file", "." ]
def write(self, fptr): self._validate(writing=True) length = 16 + 4 * len(self.compatibility_list) fptr.write(struct.pack('>I4s', length, b'ftyp')) fptr.write(self.brand.encode()) fptr.write(struct.pack('>I', self.minor_version)) for item in self.compatibility_list: ...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "self", ".", "_validate", "(", "writing", "=", "True", ")", "length", "=", "16", "+", "4", "*", "len", "(", "self", ".", "compatibility_list", ")", "fptr", ".", "write", "(", "struct", ".", "pack"...
Write a File Type box to file.
[ "Write", "a", "File", "Type", "box", "to", "file", "." ]
[ "\"\"\"Write a File Type box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a fragment list box to file. """ self._validate(writing=True) num_items = len(self.fragment_offset) length = 8 + 2 + num_items * 14 fptr.write(struct.pack('>I4s', length, b'flst')) fptr.write(struct.pack('>H', num_items)) fo...
Write a fragment list box to file.
Write a fragment list box to file.
[ "Write", "a", "fragment", "list", "box", "to", "file", "." ]
def write(self, fptr): self._validate(writing=True) num_items = len(self.fragment_offset) length = 8 + 2 + num_items * 14 fptr.write(struct.pack('>I4s', length, b'flst')) fptr.write(struct.pack('>H', num_items)) for j in range(num_items): write_buffer = struct...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "self", ".", "_validate", "(", "writing", "=", "True", ")", "num_items", "=", "len", "(", "self", ".", "fragment_offset", ")", "length", "=", "8", "+", "2", "+", "num_items", "*", "14", "fptr", "....
Write a fragment list box to file.
[ "Write", "a", "fragment", "list", "box", "to", "file", "." ]
[ "\"\"\"Write a fragment list box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_validate
null
def _validate(self, writing=False): """Self-validate the box before writing.""" box_ids = [box.box_id for box in self.box] if len(box_ids) != 1 or box_ids[0] != 'flst': msg = ("Fragment table boxes must have a single fragment list " "box as a child box.") ...
Self-validate the box before writing.
Self-validate the box before writing.
[ "Self", "-", "validate", "the", "box", "before", "writing", "." ]
def _validate(self, writing=False): box_ids = [box.box_id for box in self.box] if len(box_ids) != 1 or box_ids[0] != 'flst': msg = ("Fragment table boxes must have a single fragment list " "box as a child box.") self._dispatch_validation_error(msg, writing=writ...
[ "def", "_validate", "(", "self", ",", "writing", "=", "False", ")", ":", "box_ids", "=", "[", "box", ".", "box_id", "for", "box", "in", "self", ".", "box", "]", "if", "len", "(", "box_ids", ")", "!=", "1", "or", "box_ids", "[", "0", "]", "!=", ...
Self-validate the box before writing.
[ "Self", "-", "validate", "the", "box", "before", "writing", "." ]
[ "\"\"\"Self-validate the box before writing.\"\"\"" ]
[ { "param": "self", "type": null }, { "param": "writing", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "writing", "type": null, "docstring": null, "docstring_tokens"...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a fragment table box to file. """ self._validate(writing=True) self._write_superbox(fptr, b'ftbl')
Write a fragment table box to file.
Write a fragment table box to file.
[ "Write", "a", "fragment", "table", "box", "to", "file", "." ]
def write(self, fptr): self._validate(writing=True) self._write_superbox(fptr, b'ftbl')
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "self", ".", "_validate", "(", "writing", "=", "True", ")", "self", ".", "_write_superbox", "(", "fptr", ",", "b'ftbl'", ")" ]
Write a fragment table box to file.
[ "Write", "a", "fragment", "table", "box", "to", "file", "." ]
[ "\"\"\"Write a fragment table box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write an Image Header box to file. """ fptr.write(struct.pack('>I4s', 22, b'ihdr')) # signedness and bps are stored together in a single byte bit_depth_signedness = 0x80 if self.signed else 0x00 bit_depth_signedness |= self.bits_per_component - ...
Write an Image Header box to file.
Write an Image Header box to file.
[ "Write", "an", "Image", "Header", "box", "to", "file", "." ]
def write(self, fptr): fptr.write(struct.pack('>I4s', 22, b'ihdr')) bit_depth_signedness = 0x80 if self.signed else 0x00 bit_depth_signedness |= self.bits_per_component - 1 read_buffer = struct.pack('>IIHBBBB', self.height, ...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>I4s'", ",", "22", ",", "b'ihdr'", ")", ")", "bit_depth_signedness", "=", "0x80", "if", "self", ".", "signed", "else", "0x00", "bit_depth_signe...
Write an Image Header box to file.
[ "Write", "an", "Image", "Header", "box", "to", "file", "." ]
[ "\"\"\"Write an Image Header box to file.\n \"\"\"", "# signedness and bps are stored together in a single byte" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a JPEG 2000 Signature box to file. """ fptr.write(struct.pack('>I4s', 12, b'jP ')) fptr.write(struct.pack('>BBBB', *self.signature))
Write a JPEG 2000 Signature box to file.
Write a JPEG 2000 Signature box to file.
[ "Write", "a", "JPEG", "2000", "Signature", "box", "to", "file", "." ]
def write(self, fptr): fptr.write(struct.pack('>I4s', 12, b'jP ')) fptr.write(struct.pack('>BBBB', *self.signature))
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>I4s'", ",", "12", ",", "b'jP '", ")", ")", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>BBBB'", ",", "*", "self", ".", "...
Write a JPEG 2000 Signature box to file.
[ "Write", "a", "JPEG", "2000", "Signature", "box", "to", "file", "." ]
[ "\"\"\"Write a JPEG 2000 Signature box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_validate
null
def _validate(self, writing=False): """Verify that the box obeys the specifications.""" if (((len(self.bits_per_component) != len(self.signed)) or (len(self.signed) != self.palette.shape[1]))): msg = ("The length of the 'bits_per_component' and the 'signed' " ...
Verify that the box obeys the specifications.
Verify that the box obeys the specifications.
[ "Verify", "that", "the", "box", "obeys", "the", "specifications", "." ]
def _validate(self, writing=False): if (((len(self.bits_per_component) != len(self.signed)) or (len(self.signed) != self.palette.shape[1]))): msg = ("The length of the 'bits_per_component' and the 'signed' " "members must equal the number of columns of the palette.") ...
[ "def", "_validate", "(", "self", ",", "writing", "=", "False", ")", ":", "if", "(", "(", "(", "len", "(", "self", ".", "bits_per_component", ")", "!=", "len", "(", "self", ".", "signed", ")", ")", "or", "(", "len", "(", "self", ".", "signed", ")"...
Verify that the box obeys the specifications.
[ "Verify", "that", "the", "box", "obeys", "the", "specifications", "." ]
[ "\"\"\"Verify that the box obeys the specifications.\"\"\"", "# We don't support writing palettes with bit depths that are", "# different." ]
[ { "param": "self", "type": null }, { "param": "writing", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "writing", "type": null, "docstring": null, "docstring_tokens"...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a Palette box to file. """ self._validate(writing=True) bytes_per_row = sum(self.bits_per_component) / 8 bytes_per_palette = bytes_per_row * self.palette.shape[0] box_length = 8 + 3 + self.palette.shape[1] + bytes_per_palette # Wri...
Write a Palette box to file.
Write a Palette box to file.
[ "Write", "a", "Palette", "box", "to", "file", "." ]
def write(self, fptr): self._validate(writing=True) bytes_per_row = sum(self.bits_per_component) / 8 bytes_per_palette = bytes_per_row * self.palette.shape[0] box_length = 8 + 3 + self.palette.shape[1] + bytes_per_palette write_buffer = struct.pack('>I4s', int(box_length), b'pclr...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "self", ".", "_validate", "(", "writing", "=", "True", ")", "bytes_per_row", "=", "sum", "(", "self", ".", "bits_per_component", ")", "/", "8", "bytes_per_palette", "=", "bytes_per_row", "*", "self", "....
Write a Palette box to file.
[ "Write", "a", "Palette", "box", "to", "file", "." ]
[ "\"\"\"Write a Palette box to file.\n \"\"\"", "# Write the usual (L, T) header.", "# NE, NPC", "# Bits Per Sample. Signed components aren't supported.", "# C(i,j)" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
parse
<not_specific>
def parse(cls, fptr, offset, length): """Parse reader requirements box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ...
Parse reader requirements box. Parameters ---------- fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ------- ReaderRequirementsBox ...
Parse reader requirements box. Parameters fptr : file Open file object. offset : int Start position of box in bytes. length : int Length of the box in bytes. Returns ReaderRequirementsBox Instance of the current reader requirements box.
[ "Parse", "reader", "requirements", "box", ".", "Parameters", "fptr", ":", "file", "Open", "file", "object", ".", "offset", ":", "int", "Start", "position", "of", "box", "in", "bytes", ".", "length", ":", "int", "Length", "of", "the", "box", "in", "bytes"...
def parse(cls, fptr, offset, length): num_bytes = offset + length - fptr.tell() read_buffer = fptr.read(num_bytes) mask_length, = struct.unpack_from('>B', read_buffer, offset=0) fuam = dcm = standard_flag = standard_mask = [] vendor_feature = vendor_mask = [] try: ...
[ "def", "parse", "(", "cls", ",", "fptr", ",", "offset", ",", "length", ")", ":", "num_bytes", "=", "offset", "+", "length", "-", "fptr", ".", "tell", "(", ")", "read_buffer", "=", "fptr", ".", "read", "(", "num_bytes", ")", "mask_length", ",", "=", ...
Parse reader requirements box.
[ "Parse", "reader", "requirements", "box", "." ]
[ "\"\"\"Parse reader requirements box.\n\n Parameters\n ----------\n fptr : file\n Open file object.\n offset : int\n Start position of box in bytes.\n length : int\n Length of the box in bytes.\n\n Returns\n -------\n ReaderReq...
[ { "param": "cls", "type": null }, { "param": "fptr", "type": null }, { "param": "offset", "type": null }, { "param": "length", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "cls", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": []...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_parse_standard_flag
<not_specific>
def _parse_standard_flag(read_buffer, mask_length): """Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag ...
Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag
Construct standard flag, standard mask data from the file. Specifically working on Reader Requirements box. Parameters fptr : file object File object for JP2K file. mask_length : int Length of standard mask flag
[ "Construct", "standard", "flag", "standard", "mask", "data", "from", "the", "file", ".", "Specifically", "working", "on", "Reader", "Requirements", "box", ".", "Parameters", "fptr", ":", "file", "object", "File", "object", "for", "JP2K", "file", ".", "mask_len...
def _parse_standard_flag(read_buffer, mask_length): mask_format = {1: 'B', 2: 'H', 4: 'I'}[mask_length] num_standard_flags, = struct.unpack_from('>H', read_buffer, offset=0) fmt = '>' + ('H' + mask_format) * num_standard_flags data = struct.unpack_from(fmt, read_buffer, offset=2) standard_flag = dat...
[ "def", "_parse_standard_flag", "(", "read_buffer", ",", "mask_length", ")", ":", "mask_format", "=", "{", "1", ":", "'B'", ",", "2", ":", "'H'", ",", "4", ":", "'I'", "}", "[", "mask_length", "]", "num_standard_flags", ",", "=", "struct", ".", "unpack_fr...
Construct standard flag, standard mask data from the file.
[ "Construct", "standard", "flag", "standard", "mask", "data", "from", "the", "file", "." ]
[ "\"\"\"Construct standard flag, standard mask data from the file.\n\n Specifically working on Reader Requirements box.\n\n Parameters\n ----------\n fptr : file object\n File object for JP2K file.\n mask_length : int\n Length of standard mask flag\n \"\"\"", "# The mask length tell...
[ { "param": "read_buffer", "type": null }, { "param": "mask_length", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "read_buffer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mask_length", "type": null, "docstring": null, "docstr...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_parse_vendor_features
<not_specific>
def _parse_vendor_features(read_buffer, mask_length): """Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag ...
Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters ---------- fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag
Construct vendor features, vendor mask data from the file. Specifically working on Reader Requirements box. Parameters fptr : file object File object for JP2K file. mask_length : int Length of vendor mask flag
[ "Construct", "vendor", "features", "vendor", "mask", "data", "from", "the", "file", ".", "Specifically", "working", "on", "Reader", "Requirements", "box", ".", "Parameters", "fptr", ":", "file", "object", "File", "object", "for", "JP2K", "file", ".", "mask_len...
def _parse_vendor_features(read_buffer, mask_length): mask_format = {1: 'B', 2: 'H', 4: 'I'}[mask_length] num_vendor_features, = struct.unpack_from('>H', read_buffer) entry_length = 16 + mask_length vendor_feature = [] vendor_mask = [] for j in range(num_vendor_features): uslice = slice(...
[ "def", "_parse_vendor_features", "(", "read_buffer", ",", "mask_length", ")", ":", "mask_format", "=", "{", "1", ":", "'B'", ",", "2", ":", "'H'", ",", "4", ":", "'I'", "}", "[", "mask_length", "]", "num_vendor_features", ",", "=", "struct", ".", "unpack...
Construct vendor features, vendor mask data from the file.
[ "Construct", "vendor", "features", "vendor", "mask", "data", "from", "the", "file", "." ]
[ "\"\"\"Construct vendor features, vendor mask data from the file.\n\n Specifically working on Reader Requirements box.\n\n Parameters\n ----------\n fptr : file object\n File object for JP2K file.\n mask_length : int\n Length of vendor mask flag\n \"\"\"", "# The mask length tells ...
[ { "param": "read_buffer", "type": null }, { "param": "mask_length", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "read_buffer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mask_length", "type": null, "docstring": null, "docstr...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a Label box to file. """ length = 8 + len(self.label.encode()) fptr.write(struct.pack('>I4s', length, b'lbl ')) fptr.write(self.label.encode())
Write a Label box to file.
Write a Label box to file.
[ "Write", "a", "Label", "box", "to", "file", "." ]
def write(self, fptr): length = 8 + len(self.label.encode()) fptr.write(struct.pack('>I4s', length, b'lbl ')) fptr.write(self.label.encode())
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "length", "=", "8", "+", "len", "(", "self", ".", "label", ".", "encode", "(", ")", ")", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>I4s'", ",", "length", ",", "b'lbl '", ")", ")...
Write a Label box to file.
[ "Write", "a", "Label", "box", "to", "file", "." ]
[ "\"\"\"Write a Label box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a NumberList box to file. """ fptr.write(struct.pack('>I4s', len(self.associations) * 4 + 8, b'nlst')) fmt = '>' + 'I' * len(self.associations) write_buffer = struct.pack(fmt, *self.associations) fptr.write(w...
Write a NumberList box to file.
Write a NumberList box to file.
[ "Write", "a", "NumberList", "box", "to", "file", "." ]
def write(self, fptr): fptr.write(struct.pack('>I4s', len(self.associations) * 4 + 8, b'nlst')) fmt = '>' + 'I' * len(self.associations) write_buffer = struct.pack(fmt, *self.associations) fptr.write(write_buffer)
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>I4s'", ",", "len", "(", "self", ".", "associations", ")", "*", "4", "+", "8", ",", "b'nlst'", ")", ")", "fmt", "=", "'>'", "+", "'I'",...
Write a NumberList box to file.
[ "Write", "a", "NumberList", "box", "to", "file", "." ]
[ "\"\"\"Write a NumberList box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """ Write an XML box to file. """ read_buffer = ET.tostring(self.xml.getroot(), encoding='utf-8') fptr.write(struct.pack('>I4s', len(read_buffer) + 8, b'xml ')) fptr.write(read_buffer)
Write an XML box to file.
Write an XML box to file.
[ "Write", "an", "XML", "box", "to", "file", "." ]
def write(self, fptr): read_buffer = ET.tostring(self.xml.getroot(), encoding='utf-8') fptr.write(struct.pack('>I4s', len(read_buffer) + 8, b'xml ')) fptr.write(read_buffer)
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "read_buffer", "=", "ET", ".", "tostring", "(", "self", ".", "xml", ".", "getroot", "(", ")", ",", "encoding", "=", "'utf-8'", ")", "fptr", ".", "write", "(", "struct", ".", "pack", "(", "'>I4s'",...
Write an XML box to file.
[ "Write", "an", "XML", "box", "to", "file", "." ]
[ "\"\"\"\n Write an XML box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a UUID list box to file. """ num_uuids = len(self.ulst) length = 4 + 4 + 2 + num_uuids * 16 write_buffer = struct.pack('>I4sH', length, b'ulst', num_uuids) fptr.write(write_buffer) for j in range(num_uuids): fptr.write(...
Write a UUID list box to file.
Write a UUID list box to file.
[ "Write", "a", "UUID", "list", "box", "to", "file", "." ]
def write(self, fptr): num_uuids = len(self.ulst) length = 4 + 4 + 2 + num_uuids * 16 write_buffer = struct.pack('>I4sH', length, b'ulst', num_uuids) fptr.write(write_buffer) for j in range(num_uuids): fptr.write(self.ulst[j].bytes)
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "num_uuids", "=", "len", "(", "self", ".", "ulst", ")", "length", "=", "4", "+", "4", "+", "2", "+", "num_uuids", "*", "16", "write_buffer", "=", "struct", ".", "pack", "(", "'>I4sH'", ",", "len...
Write a UUID list box to file.
[ "Write", "a", "UUID", "list", "box", "to", "file", "." ]
[ "\"\"\"Write a UUID list box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a data entry url box to file. """ # Make sure it is written out as null-terminated. url = self.url if self.url[-1] != chr(0): url = url + chr(0) url = url.encode() length = 8 + 1 + 3 + len(url) write_buffer = st...
Write a data entry url box to file.
Write a data entry url box to file.
[ "Write", "a", "data", "entry", "url", "box", "to", "file", "." ]
def write(self, fptr): url = self.url if self.url[-1] != chr(0): url = url + chr(0) url = url.encode() length = 8 + 1 + 3 + len(url) write_buffer = struct.pack('>I4sBBBB', length, b'url ', self.vers...
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "url", "=", "self", ".", "url", "if", "self", ".", "url", "[", "-", "1", "]", "!=", "chr", "(", "0", ")", ":", "url", "=", "url", "+", "chr", "(", "0", ")", "url", "=", "url", ".", "enco...
Write a data entry url box to file.
[ "Write", "a", "data", "entry", "url", "box", "to", "file", "." ]
[ "\"\"\"Write a data entry url box to file.\n \"\"\"", "# Make sure it is written out as null-terminated." ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_parse_raw_data
null
def _parse_raw_data(self): """ Private function for parsing UUID payloads if possible. """ if self.uuid == _XMP_UUID: txt = self.raw_data.decode('utf-8') elt = ET.fromstring(txt) self.data = ET.ElementTree(elt) elif self.uuid == _GEOTIFF_UUID: ...
Private function for parsing UUID payloads if possible.
Private function for parsing UUID payloads if possible.
[ "Private", "function", "for", "parsing", "UUID", "payloads", "if", "possible", "." ]
def _parse_raw_data(self): if self.uuid == _XMP_UUID: txt = self.raw_data.decode('utf-8') elt = ET.fromstring(txt) self.data = ET.ElementTree(elt) elif self.uuid == _GEOTIFF_UUID: self.data = tiff_header(self.raw_data) elif self.uuid == _EXIF_UUID:...
[ "def", "_parse_raw_data", "(", "self", ")", ":", "if", "self", ".", "uuid", "==", "_XMP_UUID", ":", "txt", "=", "self", ".", "raw_data", ".", "decode", "(", "'utf-8'", ")", "elt", "=", "ET", ".", "fromstring", "(", "txt", ")", "self", ".", "data", ...
Private function for parsing UUID payloads if possible.
[ "Private", "function", "for", "parsing", "UUID", "payloads", "if", "possible", "." ]
[ "\"\"\"\n Private function for parsing UUID payloads if possible.\n \"\"\"", "# Cut off 'EXIF\\0\\0' part." ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
_print_geotiff_as_geotiff
<not_specific>
def _print_geotiff_as_geotiff(self): """ Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns ------- str String representation of the degenerate geotiff. """ if self.data is None: return "corrupt" in_mem_nam...
Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns ------- str String representation of the degenerate geotiff.
Print geotiff information. Shamelessly ripped off from gdalinfo.py Returns str String representation of the degenerate geotiff.
[ "Print", "geotiff", "information", ".", "Shamelessly", "ripped", "off", "from", "gdalinfo", ".", "py", "Returns", "str", "String", "representation", "of", "the", "degenerate", "geotiff", "." ]
def _print_geotiff_as_geotiff(self): if self.data is None: return "corrupt" in_mem_name = '/vsimem/geo.tif' gdal.FileFromMemBuffer(in_mem_name, self.raw_data) gtif = gdal.Open(in_mem_name) proj_ref = gtif.GetProjectionRef() sref = osr.SpatialReference() ...
[ "def", "_print_geotiff_as_geotiff", "(", "self", ")", ":", "if", "self", ".", "data", "is", "None", ":", "return", "\"corrupt\"", "in_mem_name", "=", "'/vsimem/geo.tif'", "gdal", ".", "FileFromMemBuffer", "(", "in_mem_name", ",", "self", ".", "raw_data", ")", ...
Print geotiff information.
[ "Print", "geotiff", "information", "." ]
[ "\"\"\"\n Print geotiff information. Shamelessly ripped off from gdalinfo.py\n\n Returns\n -------\n str\n String representation of the degenerate geotiff.\n \"\"\"", "# Report projection", "# report geotransform", "# setup projected to lat/long transform if appr...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4260ea73b82212526152b00ceb5e1bce0aa8c3aa
feature-engineer/glymur
glymur/jp2box.py
[ "MIT" ]
Python
write
null
def write(self, fptr): """Write a UUID box to file. """ length = 4 + 4 + 16 + len(self.raw_data) write_buffer = struct.pack('>I4s', length, b'uuid') fptr.write(write_buffer) fptr.write(self.uuid.bytes) fptr.write(self.raw_data)
Write a UUID box to file.
Write a UUID box to file.
[ "Write", "a", "UUID", "box", "to", "file", "." ]
def write(self, fptr): length = 4 + 4 + 16 + len(self.raw_data) write_buffer = struct.pack('>I4s', length, b'uuid') fptr.write(write_buffer) fptr.write(self.uuid.bytes) fptr.write(self.raw_data)
[ "def", "write", "(", "self", ",", "fptr", ")", ":", "length", "=", "4", "+", "4", "+", "16", "+", "len", "(", "self", ".", "raw_data", ")", "write_buffer", "=", "struct", ".", "pack", "(", "'>I4s'", ",", "length", ",", "b'uuid'", ")", "fptr", "."...
Write a UUID box to file.
[ "Write", "a", "UUID", "box", "to", "file", "." ]
[ "\"\"\"Write a UUID box to file.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
9f1e6bbfeb8b7bdc80270961124978cf05d5bbdc
feature-engineer/glymur
glymur/lib/openjp2.py
[ "MIT" ]
Python
version
<not_specific>
def version(): """Wrapper for opj_version library routine.""" try: OPENJP2.opj_version.restype = ctypes.c_char_p except AttributeError: return "0.0.0" v = OPENJP2.opj_version() return v.decode('utf-8')
Wrapper for opj_version library routine.
Wrapper for opj_version library routine.
[ "Wrapper", "for", "opj_version", "library", "routine", "." ]
def version(): try: OPENJP2.opj_version.restype = ctypes.c_char_p except AttributeError: return "0.0.0" v = OPENJP2.opj_version() return v.decode('utf-8')
[ "def", "version", "(", ")", ":", "try", ":", "OPENJP2", ".", "opj_version", ".", "restype", "=", "ctypes", ".", "c_char_p", "except", "AttributeError", ":", "return", "\"0.0.0\"", "v", "=", "OPENJP2", ".", "opj_version", "(", ")", "return", "v", ".", "de...
Wrapper for opj_version library routine.
[ "Wrapper", "for", "opj_version", "library", "routine", "." ]
[ "\"\"\"Wrapper for opj_version library routine.\"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9f1e6bbfeb8b7bdc80270961124978cf05d5bbdc
feature-engineer/glymur
glymur/lib/openjp2.py
[ "MIT" ]
Python
check_error
null
def check_error(status): """Set a generic function as the restype attribute of all OpenJPEG functions that return a BOOL_TYPE value. This way we do not have to check for error status in each wrapping function and an exception will always be appropriately raised. """ if status != 1: lst ...
Set a generic function as the restype attribute of all OpenJPEG functions that return a BOOL_TYPE value. This way we do not have to check for error status in each wrapping function and an exception will always be appropriately raised.
Set a generic function as the restype attribute of all OpenJPEG functions that return a BOOL_TYPE value. This way we do not have to check for error status in each wrapping function and an exception will always be appropriately raised.
[ "Set", "a", "generic", "function", "as", "the", "restype", "attribute", "of", "all", "OpenJPEG", "functions", "that", "return", "a", "BOOL_TYPE", "value", ".", "This", "way", "we", "do", "not", "have", "to", "check", "for", "error", "status", "in", "each",...
def check_error(status): if status != 1: lst = [] while ERROR_MSG_LST.qsize() > 0: lst.append(ERROR_MSG_LST.get()) msg = '\n'.join(lst) raise OpenJPEGLibraryError(msg)
[ "def", "check_error", "(", "status", ")", ":", "if", "status", "!=", "1", ":", "lst", "=", "[", "]", "while", "ERROR_MSG_LST", ".", "qsize", "(", ")", ">", "0", ":", "lst", ".", "append", "(", "ERROR_MSG_LST", ".", "get", "(", ")", ")", "msg", "=...
Set a generic function as the restype attribute of all OpenJPEG functions that return a BOOL_TYPE value.
[ "Set", "a", "generic", "function", "as", "the", "restype", "attribute", "of", "all", "OpenJPEG", "functions", "that", "return", "a", "BOOL_TYPE", "value", "." ]
[ "\"\"\"Set a generic function as the restype attribute of all OpenJPEG\n functions that return a BOOL_TYPE value. This way we do not have to check\n for error status in each wrapping function and an exception will always be\n appropriately raised.\n \"\"\"" ]
[ { "param": "status", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "status", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f1e6bbfeb8b7bdc80270961124978cf05d5bbdc
feature-engineer/glymur
glymur/lib/openjp2.py
[ "MIT" ]
Python
destroy_codec
null
def destroy_codec(codec): """Destroy a decompressor handle. Wraps the openjp2 library function opj_destroy_codec. Parameters ---------- codec : CODEC_TYPE Decompressor handle to destroy. """ OPENJP2.opj_destroy_codec.argtypes = [CODEC_TYPE] OPENJP2.opj_destroy_codec.restype = c...
Destroy a decompressor handle. Wraps the openjp2 library function opj_destroy_codec. Parameters ---------- codec : CODEC_TYPE Decompressor handle to destroy.
Destroy a decompressor handle. Wraps the openjp2 library function opj_destroy_codec. Parameters codec : CODEC_TYPE Decompressor handle to destroy.
[ "Destroy", "a", "decompressor", "handle", ".", "Wraps", "the", "openjp2", "library", "function", "opj_destroy_codec", ".", "Parameters", "codec", ":", "CODEC_TYPE", "Decompressor", "handle", "to", "destroy", "." ]
def destroy_codec(codec): OPENJP2.opj_destroy_codec.argtypes = [CODEC_TYPE] OPENJP2.opj_destroy_codec.restype = ctypes.c_void_p OPENJP2.opj_destroy_codec(codec)
[ "def", "destroy_codec", "(", "codec", ")", ":", "OPENJP2", ".", "opj_destroy_codec", ".", "argtypes", "=", "[", "CODEC_TYPE", "]", "OPENJP2", ".", "opj_destroy_codec", ".", "restype", "=", "ctypes", ".", "c_void_p", "OPENJP2", ".", "opj_destroy_codec", "(", "c...
Destroy a decompressor handle.
[ "Destroy", "a", "decompressor", "handle", "." ]
[ "\"\"\"Destroy a decompressor handle.\n\n Wraps the openjp2 library function opj_destroy_codec.\n\n Parameters\n ----------\n codec : CODEC_TYPE\n Decompressor handle to destroy.\n \"\"\"" ]
[ { "param": "codec", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "codec", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9f1e6bbfeb8b7bdc80270961124978cf05d5bbdc
feature-engineer/glymur
glymur/lib/openjp2.py
[ "MIT" ]
Python
has_thread_support
<not_specific>
def has_thread_support(): """ Is the library configured with thread support? Returns ------- True if the library is configured with thread support. """ OPENJP2.opj_has_thread_support.restype = BOOL_TYPE ret = OPENJP2.opj_has_thread_support() return True if ret else False
Is the library configured with thread support? Returns ------- True if the library is configured with thread support.
True if the library is configured with thread support.
[ "True", "if", "the", "library", "is", "configured", "with", "thread", "support", "." ]
def has_thread_support(): OPENJP2.opj_has_thread_support.restype = BOOL_TYPE ret = OPENJP2.opj_has_thread_support() return True if ret else False
[ "def", "has_thread_support", "(", ")", ":", "OPENJP2", ".", "opj_has_thread_support", ".", "restype", "=", "BOOL_TYPE", "ret", "=", "OPENJP2", ".", "opj_has_thread_support", "(", ")", "return", "True", "if", "ret", "else", "False" ]
Is the library configured with thread support?
[ "Is", "the", "library", "configured", "with", "thread", "support?" ]
[ "\"\"\"\n Is the library configured with thread support?\n\n Returns\n -------\n True if the library is configured with thread support.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9f1e6bbfeb8b7bdc80270961124978cf05d5bbdc
feature-engineer/glymur
glymur/lib/openjp2.py
[ "MIT" ]
Python
image_destroy
null
def image_destroy(image): """Deallocate any resources associated with an image. Wraps the openjp2 library function opj_image_destroy. Parameters ---------- image : ImageType pointer Image resource to be disposed. """ OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] ...
Deallocate any resources associated with an image. Wraps the openjp2 library function opj_image_destroy. Parameters ---------- image : ImageType pointer Image resource to be disposed.
Deallocate any resources associated with an image. Wraps the openjp2 library function opj_image_destroy. Parameters image : ImageType pointer Image resource to be disposed.
[ "Deallocate", "any", "resources", "associated", "with", "an", "image", ".", "Wraps", "the", "openjp2", "library", "function", "opj_image_destroy", ".", "Parameters", "image", ":", "ImageType", "pointer", "Image", "resource", "to", "be", "disposed", "." ]
def image_destroy(image): OPENJP2.opj_image_destroy.argtypes = [ctypes.POINTER(ImageType)] OPENJP2.opj_image_destroy.restype = ctypes.c_void_p OPENJP2.opj_image_destroy(image)
[ "def", "image_destroy", "(", "image", ")", ":", "OPENJP2", ".", "opj_image_destroy", ".", "argtypes", "=", "[", "ctypes", ".", "POINTER", "(", "ImageType", ")", "]", "OPENJP2", ".", "opj_image_destroy", ".", "restype", "=", "ctypes", ".", "c_void_p", "OPENJP...
Deallocate any resources associated with an image.
[ "Deallocate", "any", "resources", "associated", "with", "an", "image", "." ]
[ "\"\"\"Deallocate any resources associated with an image.\n\n Wraps the openjp2 library function opj_image_destroy.\n\n Parameters\n ----------\n image : ImageType pointer\n Image resource to be disposed.\n \"\"\"" ]
[ { "param": "image", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "image", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
1e827f4924bb71c9103860f65f9c8e13747e8635
feature-engineer/glymur
glymur/codestream.py
[ "MIT" ]
Python
_parse_reserved_marker
<not_specific>
def _parse_reserved_marker(self, fptr): """Marker range between 0xff30 and 0xff39. """ the_id = f'0x{self._marker_id:x}' segment = Segment(marker_id=the_id, offset=self._offset, length=0) return segment
Marker range between 0xff30 and 0xff39.
Marker range between 0xff30 and 0xff39.
[ "Marker", "range", "between", "0xff30", "and", "0xff39", "." ]
def _parse_reserved_marker(self, fptr): the_id = f'0x{self._marker_id:x}' segment = Segment(marker_id=the_id, offset=self._offset, length=0) return segment
[ "def", "_parse_reserved_marker", "(", "self", ",", "fptr", ")", ":", "the_id", "=", "f'0x{self._marker_id:x}'", "segment", "=", "Segment", "(", "marker_id", "=", "the_id", ",", "offset", "=", "self", ".", "_offset", ",", "length", "=", "0", ")", "return", ...
Marker range between 0xff30 and 0xff39.
[ "Marker", "range", "between", "0xff30", "and", "0xff39", "." ]
[ "\"\"\"Marker range between 0xff30 and 0xff39.\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "fptr", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "fptr", "type": null, "docstring": null, "docstring_tokens": [...
ef52b2aa81d2aa14192982586cec1e33178e59fb
feature-engineer/glymur
glymur/config.py
[ "MIT" ]
Python
_determine_full_path
<not_specific>
def _determine_full_path(libname): """ Try to determine the path to the openjp2 library. Parameters ---------- libname : str short name for library (openjp2) Returns ------- path to openjp2 library or None if openjp2 library not found """ # A location specified by the ...
Try to determine the path to the openjp2 library. Parameters ---------- libname : str short name for library (openjp2) Returns ------- path to openjp2 library or None if openjp2 library not found
Try to determine the path to the openjp2 library. Parameters libname : str short name for library (openjp2) Returns path to openjp2 library or None if openjp2 library not found
[ "Try", "to", "determine", "the", "path", "to", "the", "openjp2", "library", ".", "Parameters", "libname", ":", "str", "short", "name", "for", "library", "(", "openjp2", ")", "Returns", "path", "to", "openjp2", "library", "or", "None", "if", "openjp2", "lib...
def _determine_full_path(libname): path = read_config_file(libname) if path is not None: return path if platform.system().startswith('CYGWIN'): g = pathlib.Path('/usr/bin').glob('cygopenjp2*.dll') try: path = list(g)[0] except IndexError: pass ...
[ "def", "_determine_full_path", "(", "libname", ")", ":", "path", "=", "read_config_file", "(", "libname", ")", "if", "path", "is", "not", "None", ":", "return", "path", "if", "platform", ".", "system", "(", ")", ".", "startswith", "(", "'CYGWIN'", ")", "...
Try to determine the path to the openjp2 library.
[ "Try", "to", "determine", "the", "path", "to", "the", "openjp2", "library", "." ]
[ "\"\"\"\n Try to determine the path to the openjp2 library.\n\n Parameters\n ----------\n libname : str\n short name for library (openjp2)\n\n Returns\n -------\n path to openjp2 library or None if openjp2 library not found\n \"\"\"", "# A location specified by the glymur configurat...
[ { "param": "libname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "libname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ef52b2aa81d2aa14192982586cec1e33178e59fb
feature-engineer/glymur
glymur/config.py
[ "MIT" ]
Python
read_config_file
<not_specific>
def read_config_file(libname): """ Extract library locations from a configuration file. Parameters ---------- libname : str One of either 'openjp2' or 'openjpeg' Returns ------- path : None or path None if no location is specified, otherwise a path to the library ""...
Extract library locations from a configuration file. Parameters ---------- libname : str One of either 'openjp2' or 'openjpeg' Returns ------- path : None or path None if no location is specified, otherwise a path to the library
Extract library locations from a configuration file. Parameters libname : str One of either 'openjp2' or 'openjpeg' Returns path : None or path None if no location is specified, otherwise a path to the library
[ "Extract", "library", "locations", "from", "a", "configuration", "file", ".", "Parameters", "libname", ":", "str", "One", "of", "either", "'", "openjp2", "'", "or", "'", "openjpeg", "'", "Returns", "path", ":", "None", "or", "path", "None", "if", "no", "...
def read_config_file(libname): filename = glymurrc_fname() if filename is None: return None parser = ConfigParser() parser.read(filename) try: path = parser.get('library', libname) except (NoOptionError, NoSectionError): path = None else: path = pathlib.Path(p...
[ "def", "read_config_file", "(", "libname", ")", ":", "filename", "=", "glymurrc_fname", "(", ")", "if", "filename", "is", "None", ":", "return", "None", "parser", "=", "ConfigParser", "(", ")", "parser", ".", "read", "(", "filename", ")", "try", ":", "pa...
Extract library locations from a configuration file.
[ "Extract", "library", "locations", "from", "a", "configuration", "file", "." ]
[ "\"\"\"\n Extract library locations from a configuration file.\n\n Parameters\n ----------\n libname : str\n One of either 'openjp2' or 'openjpeg'\n\n Returns\n -------\n path : None or path\n None if no location is specified, otherwise a path to the library\n \"\"\"", "# The...
[ { "param": "libname", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "libname", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
ef52b2aa81d2aa14192982586cec1e33178e59fb
feature-engineer/glymur
glymur/config.py
[ "MIT" ]
Python
glymur_config
<not_specific>
def glymur_config(): """ Try to ascertain locations of openjp2 library. Returns ------- tuple tuple of library handles """ libname = 'openjp2' path = _determine_full_path(libname) if path is None or path in ['None', 'none']: # Either could not find a library via cty...
Try to ascertain locations of openjp2 library. Returns ------- tuple tuple of library handles
Try to ascertain locations of openjp2 library. Returns tuple tuple of library handles
[ "Try", "to", "ascertain", "locations", "of", "openjp2", "library", ".", "Returns", "tuple", "tuple", "of", "library", "handles" ]
def glymur_config(): libname = 'openjp2' path = _determine_full_path(libname) if path is None or path in ['None', 'none']: return None loader = ctypes.windll.LoadLibrary if os.name == 'nt' else ctypes.CDLL try: opj_lib = loader(path) except TypeError: path = str(path) ...
[ "def", "glymur_config", "(", ")", ":", "libname", "=", "'openjp2'", "path", "=", "_determine_full_path", "(", "libname", ")", "if", "path", "is", "None", "or", "path", "in", "[", "'None'", ",", "'none'", "]", ":", "return", "None", "loader", "=", "ctypes...
Try to ascertain locations of openjp2 library.
[ "Try", "to", "ascertain", "locations", "of", "openjp2", "library", "." ]
[ "\"\"\"\n Try to ascertain locations of openjp2 library.\n\n Returns\n -------\n tuple\n tuple of library handles\n \"\"\"", "# Either could not find a library via ctypes or", "# user-configuration-file, or we could not find it in any of the", "# default locations, or possibly the user i...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
9088d608abd3f340ef63436c7e0de30bb525043c
feature-engineer/glymur
glymur/_tiff.py
[ "MIT" ]
Python
tiff_header
<not_specific>
def tiff_header(read_buffer): """ Interpret the uuid raw data as a tiff header. """ # First 8 should be (73, 73, 42, 8) or (77, 77, 42, 8) data = struct.unpack('BB', read_buffer[0:2]) if data[0] == 73 and data[1] == 73: # little endian endian = '<' elif data[0] == 77 and data...
Interpret the uuid raw data as a tiff header.
Interpret the uuid raw data as a tiff header.
[ "Interpret", "the", "uuid", "raw", "data", "as", "a", "tiff", "header", "." ]
def tiff_header(read_buffer): data = struct.unpack('BB', read_buffer[0:2]) if data[0] == 73 and data[1] == 73: endian = '<' elif data[0] == 77 and data[1] == 77: endian = '>' else: msg = ( f"The byte order indication in the TIFF header " f"({read_buffer[0:...
[ "def", "tiff_header", "(", "read_buffer", ")", ":", "data", "=", "struct", ".", "unpack", "(", "'BB'", ",", "read_buffer", "[", "0", ":", "2", "]", ")", "if", "data", "[", "0", "]", "==", "73", "and", "data", "[", "1", "]", "==", "73", ":", "en...
Interpret the uuid raw data as a tiff header.
[ "Interpret", "the", "uuid", "raw", "data", "as", "a", "tiff", "header", "." ]
[ "\"\"\"\n Interpret the uuid raw data as a tiff header.\n \"\"\"", "# First 8 should be (73, 73, 42, 8) or (77, 77, 42, 8)", "# little endian", "# big endian", "# This is the 'Exif Image' portion." ]
[ { "param": "read_buffer", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "read_buffer", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9088d608abd3f340ef63436c7e0de30bb525043c
feature-engineer/glymur
glymur/_tiff.py
[ "MIT" ]
Python
parse_tag
<not_specific>
def parse_tag(self, dtype, count, offset_buf): """Interpret an Exif image tag data payload. """ try: fmt = self.datatype2fmt[dtype][0] * count payload_size = self.datatype2fmt[dtype][1] * count except KeyError: msg = f'Invalid TIFF tag datatype ({dtype...
Interpret an Exif image tag data payload.
Interpret an Exif image tag data payload.
[ "Interpret", "an", "Exif", "image", "tag", "data", "payload", "." ]
def parse_tag(self, dtype, count, offset_buf): try: fmt = self.datatype2fmt[dtype][0] * count payload_size = self.datatype2fmt[dtype][1] * count except KeyError: msg = f'Invalid TIFF tag datatype ({dtype}).' raise BadTiffTagDatatype(msg) if payload...
[ "def", "parse_tag", "(", "self", ",", "dtype", ",", "count", ",", "offset_buf", ")", ":", "try", ":", "fmt", "=", "self", ".", "datatype2fmt", "[", "dtype", "]", "[", "0", "]", "*", "count", "payload_size", "=", "self", ".", "datatype2fmt", "[", "dty...
Interpret an Exif image tag data payload.
[ "Interpret", "an", "Exif", "image", "tag", "data", "payload", "." ]
[ "\"\"\"Interpret an Exif image tag data payload.\n \"\"\"", "# Interpret the payload from the 4 bytes in the tag entry.", "# Interpret the payload at the offset specified by the 4 bytes in", "# the tag entry.", "# ASCII", "# Rational or Signed Rational. Construct the list of values.", "# If just...
[ { "param": "self", "type": null }, { "param": "dtype", "type": null }, { "param": "count", "type": null }, { "param": "offset_buf", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dtype", "type": null, "docstring": null, "docstring_tokens": ...
9088d608abd3f340ef63436c7e0de30bb525043c
feature-engineer/glymur
glymur/_tiff.py
[ "MIT" ]
Python
post_process
null
def post_process(self, tagnum2name): """Map the tag name instead of tag number to the tag value. """ for tag, value in self.raw_ifd.items(): try: tag_name = tagnum2name[tag] except KeyError: # Ok, we don't recognize this tag. Just use the ...
Map the tag name instead of tag number to the tag value.
Map the tag name instead of tag number to the tag value.
[ "Map", "the", "tag", "name", "instead", "of", "tag", "number", "to", "the", "tag", "value", "." ]
def post_process(self, tagnum2name): for tag, value in self.raw_ifd.items(): try: tag_name = tagnum2name[tag] except KeyError: msg = 'Unrecognized UUID box TIFF tag ({tag}).' warnings.warn(msg, UserWarning) tag_name = tag ...
[ "def", "post_process", "(", "self", ",", "tagnum2name", ")", ":", "for", "tag", ",", "value", "in", "self", ".", "raw_ifd", ".", "items", "(", ")", ":", "try", ":", "tag_name", "=", "tagnum2name", "[", "tag", "]", "except", "KeyError", ":", "msg", "=...
Map the tag name instead of tag number to the tag value.
[ "Map", "the", "tag", "name", "instead", "of", "tag", "number", "to", "the", "tag", "value", "." ]
[ "\"\"\"Map the tag name instead of tag number to the tag value.\n \"\"\"", "# Ok, we don't recognize this tag. Just use the numeric id." ]
[ { "param": "self", "type": null }, { "param": "tagnum2name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "tagnum2name", "type": null, "docstring": null, "docstring_tok...
bfedc3476e44f1e9f05f99bd5d0d1e306484071a
MrThearMan/django-threaded-email
django_threaded_email/django_threaded_email.py
[ "MIT" ]
Python
send_threaded_mail
<not_specific>
def send_threaded_mail( subject: str, message: str, from_email: Optional[str], recipient_list: List[str], fail_silently: bool = False, auth_user: str = None, auth_password: str = None, connection: "BaseEmailBackend" = None, html_message: str = None, ): """Send an email in the bac...
Send an email in the background using the builtin threading module. :param subject: Subject of the email :param message: Email message in plain form. :param from_email: Sending email address. If None, uses settings.DEFAULT_FROM_EMAIL. :param recipient_list: List of email to send to. :param fail_sil...
Send an email in the background using the builtin threading module.
[ "Send", "an", "email", "in", "the", "background", "using", "the", "builtin", "threading", "module", "." ]
def send_threaded_mail( subject: str, message: str, from_email: Optional[str], recipient_list: List[str], fail_silently: bool = False, auth_user: str = None, auth_password: str = None, connection: "BaseEmailBackend" = None, html_message: str = None, ): def task(): return ...
[ "def", "send_threaded_mail", "(", "subject", ":", "str", ",", "message", ":", "str", ",", "from_email", ":", "Optional", "[", "str", "]", ",", "recipient_list", ":", "List", "[", "str", "]", ",", "fail_silently", ":", "bool", "=", "False", ",", "auth_use...
Send an email in the background using the builtin threading module.
[ "Send", "an", "email", "in", "the", "background", "using", "the", "builtin", "threading", "module", "." ]
[ "\"\"\"Send an email in the background using the builtin threading module.\n\n :param subject: Subject of the email\n :param message: Email message in plain form.\n :param from_email: Sending email address. If None, uses settings.DEFAULT_FROM_EMAIL.\n :param recipient_list: List of email to send to.\n ...
[ { "param": "subject", "type": "str" }, { "param": "message", "type": "str" }, { "param": "from_email", "type": "Optional[str]" }, { "param": "recipient_list", "type": "List[str]" }, { "param": "fail_silently", "type": "bool" }, { "param": "auth_user", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "subject", "type": "str", "docstring": "Subject of the email", "docstring_tokens": [ "Subject", "of", "the", "email" ], "default": null, "is_optional": null }, { "...
9d1a010f5afb32668086a06fec9abf23cb3eb6bc
alanefl/vdf-competition
inkfish/mod.py
[ "Apache-2.0" ]
Python
gcd
<not_specific>
def gcd(*args): """ Generalize math.gcd to take more than two inputs. """ items = list(args) while len(items) > 1: items.append(math.gcd(items.pop(), items.pop())) return items[0]
Generalize math.gcd to take more than two inputs.
Generalize math.gcd to take more than two inputs.
[ "Generalize", "math", ".", "gcd", "to", "take", "more", "than", "two", "inputs", "." ]
def gcd(*args): items = list(args) while len(items) > 1: items.append(math.gcd(items.pop(), items.pop())) return items[0]
[ "def", "gcd", "(", "*", "args", ")", ":", "items", "=", "list", "(", "args", ")", "while", "len", "(", "items", ")", ">", "1", ":", "items", ".", "append", "(", "math", ".", "gcd", "(", "items", ".", "pop", "(", ")", ",", "items", ".", "pop",...
Generalize math.gcd to take more than two inputs.
[ "Generalize", "math", ".", "gcd", "to", "take", "more", "than", "two", "inputs", "." ]
[ "\"\"\"\n Generalize math.gcd to take more than two inputs.\n \"\"\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7e094420748917a94d06db69b013f9b96e3ed5ac
alanefl/vdf-competition
inkfish/classgroup.py
[ "Apache-2.0" ]
Python
multiply
<not_specific>
def multiply(self, other): """ An implementation of form composition as documented by "Explaining composition". """ a1, b1, c1 = self.reduced() a2, b2, c2 = other.reduced() g = (b2 + b1) // 2 h = (b2 - b1) // 2 w = mod.gcd(a1, a2, g) j = w ...
An implementation of form composition as documented by "Explaining composition".
An implementation of form composition as documented by "Explaining composition".
[ "An", "implementation", "of", "form", "composition", "as", "documented", "by", "\"", "Explaining", "composition", "\"", "." ]
def multiply(self, other): a1, b1, c1 = self.reduced() a2, b2, c2 = other.reduced() g = (b2 + b1) // 2 h = (b2 - b1) // 2 w = mod.gcd(a1, a2, g) j = w r = 0 s = a1 // w t = a2 // w u = g // w k_temp, constant_factor = mod.solve_mod(...
[ "def", "multiply", "(", "self", ",", "other", ")", ":", "a1", ",", "b1", ",", "c1", "=", "self", ".", "reduced", "(", ")", "a2", ",", "b2", ",", "c2", "=", "other", ".", "reduced", "(", ")", "g", "=", "(", "b2", "+", "b1", ")", "//", "2", ...
An implementation of form composition as documented by "Explaining composition".
[ "An", "implementation", "of", "form", "composition", "as", "documented", "by", "\"", "Explaining", "composition", "\"", "." ]
[ "\"\"\"\n An implementation of form composition as documented by \"Explaining composition\".\n \"\"\"", "# solve these equations for k, l, m", "\"\"\"\n k * t - l * s = h\n k * u - m * s = c2\n l * u - m * t = c1\n \"\"\"", "\"\"\"\n solve\n (tu)k - (hu ...
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": null, "docstring_tokens": ...
7e094420748917a94d06db69b013f9b96e3ed5ac
alanefl/vdf-competition
inkfish/classgroup.py
[ "Apache-2.0" ]
Python
square
<not_specific>
def square(self): """ A rewrite of multiply for squaring. """ a1, b1, c1 = self.reduced() g = b1 h = 0 w = mod.gcd(a1, g) j = w r = 0 s = a1 // w t = s u = g // w # solve these equations for k, l, m """ ...
A rewrite of multiply for squaring.
A rewrite of multiply for squaring.
[ "A", "rewrite", "of", "multiply", "for", "squaring", "." ]
def square(self): a1, b1, c1 = self.reduced() g = b1 h = 0 w = mod.gcd(a1, g) j = w r = 0 s = a1 // w t = s u = g // w k_temp, constant_factor = mod.solve_mod(t * u, h * u + s * c1, s * t) n, constant_factor_2 = mod.solve_mod(t * co...
[ "def", "square", "(", "self", ")", ":", "a1", ",", "b1", ",", "c1", "=", "self", ".", "reduced", "(", ")", "g", "=", "b1", "h", "=", "0", "w", "=", "mod", ".", "gcd", "(", "a1", ",", "g", ")", "j", "=", "w", "r", "=", "0", "s", "=", "...
A rewrite of multiply for squaring.
[ "A", "rewrite", "of", "multiply", "for", "squaring", "." ]
[ "\"\"\"\n A rewrite of multiply for squaring.\n \"\"\"", "# solve these equations for k, l, m", "\"\"\"\n k * t - l * s = h\n k * u - m * s = c2\n l * u - m * t = c1\n \"\"\"", "\"\"\"\n solve\n (tu)k - (hu + sc) = 0 mod st\n k = (- hu - sc) * (tu...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f7d6402239a4f5bedf229dfcfe1d2ff7aad68cb2
alanefl/vdf-competition
inkfish/primes.py
[ "Apache-2.0" ]
Python
odd_primes_below_n
<not_specific>
def odd_primes_below_n(n): """ Returns a list of odd primes less than n. """ sieve = [True] * (n // 2) for i in range(3, int(n ** 0.5) + 1, 2): if sieve[i // 2]: sieve[i * i // 2::i] = [False] * ((n-i*i-1)//(2*i)+1) return [2 * i + 1 for i in range(1, n//2) if sieve[i]]
Returns a list of odd primes less than n.
Returns a list of odd primes less than n.
[ "Returns", "a", "list", "of", "odd", "primes", "less", "than", "n", "." ]
def odd_primes_below_n(n): sieve = [True] * (n // 2) for i in range(3, int(n ** 0.5) + 1, 2): if sieve[i // 2]: sieve[i * i // 2::i] = [False] * ((n-i*i-1)//(2*i)+1) return [2 * i + 1 for i in range(1, n//2) if sieve[i]]
[ "def", "odd_primes_below_n", "(", "n", ")", ":", "sieve", "=", "[", "True", "]", "*", "(", "n", "//", "2", ")", "for", "i", "in", "range", "(", "3", ",", "int", "(", "n", "**", "0.5", ")", "+", "1", ",", "2", ")", ":", "if", "sieve", "[", ...
Returns a list of odd primes less than n.
[ "Returns", "a", "list", "of", "odd", "primes", "less", "than", "n", "." ]
[ "\"\"\" Returns a list of odd primes less than n. \"\"\"" ]
[ { "param": "n", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "n", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
10678e882abd068edd44d6e29bed7db0340f216e
alanefl/vdf-competition
inkfish/proof_of_time.py
[ "Apache-2.0" ]
Python
generate_r_value
<not_specific>
def generate_r_value(x, y, sqrt_mu, int_size_bits): """creates an r value by hashing the inputs""" if isinstance(x, ClassGroup): s = serialize_proof([x, y, sqrt_mu]) else: int_size = int_size_bits // 8 s = (x.to_bytes(int_size, "big", signed=False) + y.to_bytes(int_size,...
creates an r value by hashing the inputs
creates an r value by hashing the inputs
[ "creates", "an", "r", "value", "by", "hashing", "the", "inputs" ]
def generate_r_value(x, y, sqrt_mu, int_size_bits): if isinstance(x, ClassGroup): s = serialize_proof([x, y, sqrt_mu]) else: int_size = int_size_bits // 8 s = (x.to_bytes(int_size, "big", signed=False) + y.to_bytes(int_size, "big", signed=False) + sqrt_mu.to_byt...
[ "def", "generate_r_value", "(", "x", ",", "y", ",", "sqrt_mu", ",", "int_size_bits", ")", ":", "if", "isinstance", "(", "x", ",", "ClassGroup", ")", ":", "s", "=", "serialize_proof", "(", "[", "x", ",", "y", ",", "sqrt_mu", "]", ")", "else", ":", "...
creates an r value by hashing the inputs
[ "creates", "an", "r", "value", "by", "hashing", "the", "inputs" ]
[ "\"\"\"creates an r value by hashing the inputs\"\"\"" ]
[ { "param": "x", "type": null }, { "param": "y", "type": null }, { "param": "sqrt_mu", "type": null }, { "param": "int_size_bits", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "y", "type": null, "docstring": null, "docstring_tokens": [], ...
10678e882abd068edd44d6e29bed7db0340f216e
alanefl/vdf-competition
inkfish/proof_of_time.py
[ "Apache-2.0" ]
Python
create_proof_of_time_pietrzak
<not_specific>
def create_proof_of_time_pietrzak(discriminant, x, iterations, int_size_bits): """ Returns a serialized proof blob. """ delta = 8 powers_to_calculate = proof_pietrzak.cache_indeces_for_count(iterations) powers = iterate_squarings(x, powers_to_calculate) y = powers[iterations] proof = pr...
Returns a serialized proof blob.
Returns a serialized proof blob.
[ "Returns", "a", "serialized", "proof", "blob", "." ]
def create_proof_of_time_pietrzak(discriminant, x, iterations, int_size_bits): delta = 8 powers_to_calculate = proof_pietrzak.cache_indeces_for_count(iterations) powers = iterate_squarings(x, powers_to_calculate) y = powers[iterations] proof = proof_pietrzak.generate_proof(x, iterations, delta, y, p...
[ "def", "create_proof_of_time_pietrzak", "(", "discriminant", ",", "x", ",", "iterations", ",", "int_size_bits", ")", ":", "delta", "=", "8", "powers_to_calculate", "=", "proof_pietrzak", ".", "cache_indeces_for_count", "(", "iterations", ")", "powers", "=", "iterate...
Returns a serialized proof blob.
[ "Returns", "a", "serialized", "proof", "blob", "." ]
[ "\"\"\"\n Returns a serialized proof blob.\n \"\"\"" ]
[ { "param": "discriminant", "type": null }, { "param": "x", "type": null }, { "param": "iterations", "type": null }, { "param": "int_size_bits", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "discriminant", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_token...
10678e882abd068edd44d6e29bed7db0340f216e
alanefl/vdf-competition
inkfish/proof_of_time.py
[ "Apache-2.0" ]
Python
check_proof_of_time_nwesolowski
<not_specific>
def check_proof_of_time_nwesolowski(discriminant, x, proof_blob, iterations, int_size_bits): """ Recursive verification function for nested wesolowski. The proof blob includes the output of the VDF, along with the proof. The following table gives an example of the rec...
Recursive verification function for nested wesolowski. The proof blob includes the output of the VDF, along with the proof. The following table gives an example of the recursive calls for a depth of 3. x | proof_blob --------------------------------------------- x | y3, proof3, y2, proof...
Recursive verification function for nested wesolowski. The proof blob includes the output of the VDF, along with the proof. The following table gives an example of the recursive calls for a depth of 3.
[ "Recursive", "verification", "function", "for", "nested", "wesolowski", ".", "The", "proof", "blob", "includes", "the", "output", "of", "the", "VDF", "along", "with", "the", "proof", ".", "The", "following", "table", "gives", "an", "example", "of", "the", "r...
def check_proof_of_time_nwesolowski(discriminant, x, proof_blob, iterations, int_size_bits): int_size = (int_size_bits + 16) >> 4 result_bytes = proof_blob[: (2 * int_size)] proof_bytes = proof_blob[(2 * int_size):] proof = deserialize_proof(proof_bytes, discriminant)...
[ "def", "check_proof_of_time_nwesolowski", "(", "discriminant", ",", "x", ",", "proof_blob", ",", "iterations", ",", "int_size_bits", ")", ":", "int_size", "=", "(", "int_size_bits", "+", "16", ")", ">>", "4", "result_bytes", "=", "proof_blob", "[", ":", "(", ...
Recursive verification function for nested wesolowski.
[ "Recursive", "verification", "function", "for", "nested", "wesolowski", "." ]
[ "\"\"\"\n Recursive verification function for nested wesolowski. The proof blob\n includes the output of the VDF, along with the proof. The following\n table gives an example of the recursive calls for a depth of 3.\n\n x | proof_blob\n ---------------------------------------------\n x | y3,...
[ { "param": "discriminant", "type": null }, { "param": "x", "type": null }, { "param": "proof_blob", "type": null }, { "param": "iterations", "type": null }, { "param": "int_size_bits", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "discriminant", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "x", "type": null, "docstring": null, "docstring_token...
381efbbb00d048731e254e2248e05a1186751c6f
alanefl/vdf-competition
inkfish/proof_pietrzak.py
[ "Apache-2.0" ]
Python
approximate_i
<not_specific>
def approximate_i(T): """Performs the approximation from the paper to select a resonable cache size""" x = (T / 16) * math.log(2) w = math.log(x) - math.log(math.log(x)) + 0.25 return round(w / (2 * math.log(2)))
Performs the approximation from the paper to select a resonable cache size
Performs the approximation from the paper to select a resonable cache size
[ "Performs", "the", "approximation", "from", "the", "paper", "to", "select", "a", "resonable", "cache", "size" ]
def approximate_i(T): x = (T / 16) * math.log(2) w = math.log(x) - math.log(math.log(x)) + 0.25 return round(w / (2 * math.log(2)))
[ "def", "approximate_i", "(", "T", ")", ":", "x", "=", "(", "T", "/", "16", ")", "*", "math", ".", "log", "(", "2", ")", "w", "=", "math", ".", "log", "(", "x", ")", "-", "math", ".", "log", "(", "math", ".", "log", "(", "x", ")", ")", "...
Performs the approximation from the paper to select a resonable cache size
[ "Performs", "the", "approximation", "from", "the", "paper", "to", "select", "a", "resonable", "cache", "size" ]
[ "\"\"\"Performs the approximation from the paper to select a resonable cache\n size\"\"\"" ]
[ { "param": "T", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "T", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
381efbbb00d048731e254e2248e05a1186751c6f
alanefl/vdf-competition
inkfish/proof_pietrzak.py
[ "Apache-2.0" ]
Python
sum_combinations
<not_specific>
def sum_combinations(numbers): """Add all combinations of the given numbers, of at least one number""" combinations = [0] for element in numbers: new_combinations = list(combinations) for element2 in combinations: new_combinations.append(element + element2) combinations =...
Add all combinations of the given numbers, of at least one number
Add all combinations of the given numbers, of at least one number
[ "Add", "all", "combinations", "of", "the", "given", "numbers", "of", "at", "least", "one", "number" ]
def sum_combinations(numbers): combinations = [0] for element in numbers: new_combinations = list(combinations) for element2 in combinations: new_combinations.append(element + element2) combinations = new_combinations combinations.remove(0) return combinations
[ "def", "sum_combinations", "(", "numbers", ")", ":", "combinations", "=", "[", "0", "]", "for", "element", "in", "numbers", ":", "new_combinations", "=", "list", "(", "combinations", ")", "for", "element2", "in", "combinations", ":", "new_combinations", ".", ...
Add all combinations of the given numbers, of at least one number
[ "Add", "all", "combinations", "of", "the", "given", "numbers", "of", "at", "least", "one", "number" ]
[ "\"\"\"Add all combinations of the given numbers, of at least one number\"\"\"", "# Remove 0" ]
[ { "param": "numbers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "numbers", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
381efbbb00d048731e254e2248e05a1186751c6f
alanefl/vdf-competition
inkfish/proof_pietrzak.py
[ "Apache-2.0" ]
Python
generate_proof
<not_specific>
def generate_proof(x, T, delta, y, powers, identity, generate_r_value, int_size_bits): """ Generate the proof. Returns a list of elements derived by operations on x. """ # Only even values work, since we need to do T/2 if T % 2 != 0: raise ValueError("T must be even") ...
Generate the proof. Returns a list of elements derived by operations on x.
Generate the proof. Returns a list of elements derived by operations on x.
[ "Generate", "the", "proof", ".", "Returns", "a", "list", "of", "elements", "derived", "by", "operations", "on", "x", "." ]
def generate_proof(x, T, delta, y, powers, identity, generate_r_value, int_size_bits): if T % 2 != 0: raise ValueError("T must be even") i = approximate_i(T) mus = [] rs = [] x_p = [x] y_p = [y] curr_T = T Ts = [] final_T = calculate_final_T(T, ...
[ "def", "generate_proof", "(", "x", ",", "T", ",", "delta", ",", "y", ",", "powers", ",", "identity", ",", "generate_r_value", ",", "int_size_bits", ")", ":", "if", "T", "%", "2", "!=", "0", ":", "raise", "ValueError", "(", "\"T must be even\"", ")", "i...
Generate the proof.
[ "Generate", "the", "proof", "." ]
[ "\"\"\"\n Generate the proof.\n Returns a list of elements derived by operations on x.\n \"\"\"", "# Only even values work, since we need to do T/2", "# random values generated using hash function", "# x prime in the paper", "# y prime in the paper", "# List of all of the Ts being used, T, then T...
[ { "param": "x", "type": null }, { "param": "T", "type": null }, { "param": "delta", "type": null }, { "param": "y", "type": null }, { "param": "powers", "type": null }, { "param": "identity", "type": null }, { "param": "generate_r_value", ...
{ "returns": [], "raises": [], "params": [ { "identifier": "x", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "T", "type": null, "docstring": null, "docstring_tokens": [], ...
99c3f1390bca3fa24ed98b3217647a2c90e33ef5
alanefl/vdf-competition
inkfish/proof_wesolowski.py
[ "Apache-2.0" ]
Python
approximate_parameters
<not_specific>
def approximate_parameters(T): """ Creates L and k parameters from papers, based on how many iterations need to be performed, and how much memory should be used. """ log_memory = math.log(10000000, 2) log_T = math.log(T, 2) L = 1 if (log_T - log_memory > 0): L = math.ceil(pow(2, ...
Creates L and k parameters from papers, based on how many iterations need to be performed, and how much memory should be used.
Creates L and k parameters from papers, based on how many iterations need to be performed, and how much memory should be used.
[ "Creates", "L", "and", "k", "parameters", "from", "papers", "based", "on", "how", "many", "iterations", "need", "to", "be", "performed", "and", "how", "much", "memory", "should", "be", "used", "." ]
def approximate_parameters(T): log_memory = math.log(10000000, 2) log_T = math.log(T, 2) L = 1 if (log_T - log_memory > 0): L = math.ceil(pow(2, log_memory - 20)) intermediate = T * math.log(2) / (2 * L) k = max([round(math.log(intermediate) - math.log(math.log(intermediate)) + 0.25), 1]...
[ "def", "approximate_parameters", "(", "T", ")", ":", "log_memory", "=", "math", ".", "log", "(", "10000000", ",", "2", ")", "log_T", "=", "math", ".", "log", "(", "T", ",", "2", ")", "L", "=", "1", "if", "(", "log_T", "-", "log_memory", ">", "0",...
Creates L and k parameters from papers, based on how many iterations need to be performed, and how much memory should be used.
[ "Creates", "L", "and", "k", "parameters", "from", "papers", "based", "on", "how", "many", "iterations", "need", "to", "be", "performed", "and", "how", "much", "memory", "should", "be", "used", "." ]
[ "\"\"\"\n Creates L and k parameters from papers, based on how many iterations need to be\n performed, and how much memory should be used.\n \"\"\"", "# Total time for proof: T/k + L * 2^(k+1)", "# To optimize, set left equal to right, and solve for k", "# k = W(T * log(2) / (2 * L)) / log(2), where...
[ { "param": "T", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "T", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9c7745d198455a6b9eb21ce1264a210242f21392
alanefl/vdf-competition
inkfish/create_discriminant.py
[ "Apache-2.0" ]
Python
create_discriminant
<not_specific>
def create_discriminant(seed, length=2048): """ Return a discriminant of the given length using the given seed. Generate a probable prime p where p % 8 == 7. Return -p. """ extra = length % 8 entropy = entropy_from_seed(seed, (length >> 3) + (2 if extra == 0 else 3)) n = (int.from_bytes(...
Return a discriminant of the given length using the given seed. Generate a probable prime p where p % 8 == 7. Return -p.
Return a discriminant of the given length using the given seed. Generate a probable prime p where p % 8 == 7. Return -p.
[ "Return", "a", "discriminant", "of", "the", "given", "length", "using", "the", "given", "seed", ".", "Generate", "a", "probable", "prime", "p", "where", "p", "%", "8", "==", "7", ".", "Return", "-", "p", "." ]
def create_discriminant(seed, length=2048): extra = length % 8 entropy = entropy_from_seed(seed, (length >> 3) + (2 if extra == 0 else 3)) n = (int.from_bytes(entropy[:-2], 'big') >> (0 if extra == 0 else 8 - extra)) | (1 << (length - 1)) n -= n % m n += residues[int.from_bytes(entropy[-2:], 'big') ...
[ "def", "create_discriminant", "(", "seed", ",", "length", "=", "2048", ")", ":", "extra", "=", "length", "%", "8", "entropy", "=", "entropy_from_seed", "(", "seed", ",", "(", "length", ">>", "3", ")", "+", "(", "2", "if", "extra", "==", "0", "else", ...
Return a discriminant of the given length using the given seed.
[ "Return", "a", "discriminant", "of", "the", "given", "length", "using", "the", "given", "seed", "." ]
[ "\"\"\"\n Return a discriminant of the given length using the given seed.\n Generate a probable prime p where p % 8 == 7.\n Return -p.\n \"\"\"", "# Find the smallest prime >= n of the form n + m*x", "# we set up \"sieve\" so it's \"True\" for known composite numbers", "# Store m*i as i", "# q =...
[ { "param": "seed", "type": null }, { "param": "length", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "seed", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "length", "type": null, "docstring": null, "docstring_tokens":...
99e7d502c75f00b020b6f74eb6d3ce0574698304
Maaitrayo/video-to-image-converter
Editor/extractor.py
[ "MIT" ]
Python
merge
null
def merge(self,prvLoc): """ Input: Previous location of the child folder conatining processed frames Output: A single folder with name of the parent folder conating all the frames """ dest=self.path+self.destfol if self.dest_Flag_: o...
Input: Previous location of the child folder conatining processed frames Output: A single folder with name of the parent folder conating all the frames
Previous location of the child folder conatining processed frames Output: A single folder with name of the parent folder conating all the frames
[ "Previous", "location", "of", "the", "child", "folder", "conatining", "processed", "frames", "Output", ":", "A", "single", "folder", "with", "name", "of", "the", "parent", "folder", "conating", "all", "the", "frames" ]
def merge(self,prvLoc): dest=self.path+self.destfol if self.dest_Flag_: os.mkdir(dest) self.dest_Flag_=False files=glob.glob(prvLoc+'*.png') files.sort() for file_ in files: folders=file_.split('/') folders[1]=self.destfol newfile_='/'.join(folders) printl='Moving...
[ "def", "merge", "(", "self", ",", "prvLoc", ")", ":", "dest", "=", "self", ".", "path", "+", "self", ".", "destfol", "if", "self", ".", "dest_Flag_", ":", "os", ".", "mkdir", "(", "dest", ")", "self", ".", "dest_Flag_", "=", "False", "files", "=", ...
Input: Previous location of the child folder conatining processed frames Output: A single folder with name of the parent folder conating all the frames
[ "Input", ":", "Previous", "location", "of", "the", "child", "folder", "conatining", "processed", "frames", "Output", ":", "A", "single", "folder", "with", "name", "of", "the", "parent", "folder", "conating", "all", "the", "frames" ]
[ "\"\"\"\n Input:\n Previous location of the \n child folder conatining processed \n frames\n Output:\n A single folder with name of the \n parent folder conating all the frames\n \"\"\"" ]
[ { "param": "self", "type": null }, { "param": "prvLoc", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "prvLoc", "type": null, "docstring": null, "docstring_tokens":...
99e7d502c75f00b020b6f74eb6d3ce0574698304
Maaitrayo/video-to-image-converter
Editor/extractor.py
[ "MIT" ]
Python
clean
null
def clean(self): """ Input: None Output: It will remove last 33 frames of the extraxted frames """ files=os.listdir(self.save) files.sort() count=33 while(count>0): popfile=files.pop() popfile=self.save+popfile os.remove(popfile)...
Input: None Output: It will remove last 33 frames of the extraxted frames
None Output: It will remove last 33 frames of the extraxted frames
[ "None", "Output", ":", "It", "will", "remove", "last", "33", "frames", "of", "the", "extraxted", "frames" ]
def clean(self): files=os.listdir(self.save) files.sort() count=33 while(count>0): popfile=files.pop() popfile=self.save+popfile os.remove(popfile) count-=1 self.i-=33 printl='Temps Cleaned...' self.logger.info(printl) self.merge(self.save)
[ "def", "clean", "(", "self", ")", ":", "files", "=", "os", ".", "listdir", "(", "self", ".", "save", ")", "files", ".", "sort", "(", ")", "count", "=", "33", "while", "(", "count", ">", "0", ")", ":", "popfile", "=", "files", ".", "pop", "(", ...
Input: None Output: It will remove last 33 frames of the extraxted frames
[ "Input", ":", "None", "Output", ":", "It", "will", "remove", "last", "33", "frames", "of", "the", "extraxted", "frames" ]
[ "\"\"\"\n Input:\n None\n Output:\n It will remove last 33\n frames of the extraxted \n frames\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e69d01c747289d400ef6f80b5e994b8eb975384b
Kaedenn/b3sim
scenarios.py
[ "BSD-2-Clause" ]
Python
_name
<not_specific>
def _name(obj, name): # {{{0 "Determine what name to use for obj" if name is None: return obj.__class__.__name__.replace("Scenario", "") return name
Determine what name to use for obj
Determine what name to use for obj
[ "Determine", "what", "name", "to", "use", "for", "obj" ]
def _name(obj, name): if name is None: return obj.__class__.__name__.replace("Scenario", "") return name
[ "def", "_name", "(", "obj", ",", "name", ")", ":", "if", "name", "is", "None", ":", "return", "obj", ".", "__class__", ".", "__name__", ".", "replace", "(", "\"Scenario\"", ",", "\"\"", ")", "return", "name" ]
Determine what name to use for obj
[ "Determine", "what", "name", "to", "use", "for", "obj" ]
[ "# {{{0", "\"Determine what name to use for obj\"" ]
[ { "param": "obj", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "obj", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": []...
e69d01c747289d400ef6f80b5e994b8eb975384b
Kaedenn/b3sim
scenarios.py
[ "BSD-2-Clause" ]
Python
_applyTransforms
<not_specific>
def _applyTransforms(self, app, objs): "Apply requested transformations on the objects" if self.get("rand"): # Adjust velocities by +/- 1% for oid in objs: v0 = app.getBodyVelocity(oid)[0] if np.linalg.norm(v0) > 0: p.resetBaseVelocity(oid, linearVelocity=( v0[0...
Apply requested transformations on the objects
Apply requested transformations on the objects
[ "Apply", "requested", "transformations", "on", "the", "objects" ]
def _applyTransforms(self, app, objs): if self.get("rand"): for oid in objs: v0 = app.getBodyVelocity(oid)[0] if np.linalg.norm(v0) > 0: p.resetBaseVelocity(oid, linearVelocity=( v0[0] + (random.random() - 0.5) * (v0[0] / 100), v0[1] + (random.random() - 0.5) ...
[ "def", "_applyTransforms", "(", "self", ",", "app", ",", "objs", ")", ":", "if", "self", ".", "get", "(", "\"rand\"", ")", ":", "for", "oid", "in", "objs", ":", "v0", "=", "app", ".", "getBodyVelocity", "(", "oid", ")", "[", "0", "]", "if", "np",...
Apply requested transformations on the objects
[ "Apply", "requested", "transformations", "on", "the", "objects" ]
[ "\"Apply requested transformations on the objects\"", "# Adjust velocities by +/- 1%", "# Set everything's restitution to 1", "# Make everything frictionless" ]
[ { "param": "self", "type": null }, { "param": "app", "type": null }, { "param": "objs", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "app", "type": null, "docstring": null, "docstring_tokens": []...
b378c378b3e49c19c66e96c21fb22b7f7f227c2a
Kaedenn/b3sim
ffi/build.py
[ "BSD-2-Clause" ]
Python
compile_module
null
def compile_module(name, cdef, code, *args, **kwargs): "Compile an FFI module into a Python module" verbose = get_remove(kwargs, "verbose", False) tmpdir = get_remove(kwargs, "tmpdir", os.getcwd()) ffibuilder = FFI() if cdef: ffibuilder.cdef(cdef) logger.debug("Compiling module {}:".format(name)) logg...
Compile an FFI module into a Python module
Compile an FFI module into a Python module
[ "Compile", "an", "FFI", "module", "into", "a", "Python", "module" ]
def compile_module(name, cdef, code, *args, **kwargs): verbose = get_remove(kwargs, "verbose", False) tmpdir = get_remove(kwargs, "tmpdir", os.getcwd()) ffibuilder = FFI() if cdef: ffibuilder.cdef(cdef) logger.debug("Compiling module {}:".format(name)) logger.debug("Module cdefs:") for lnr, line in en...
[ "def", "compile_module", "(", "name", ",", "cdef", ",", "code", ",", "*", "args", ",", "**", "kwargs", ")", ":", "verbose", "=", "get_remove", "(", "kwargs", ",", "\"verbose\"", ",", "False", ")", "tmpdir", "=", "get_remove", "(", "kwargs", ",", "\"tmp...
Compile an FFI module into a Python module
[ "Compile", "an", "FFI", "module", "into", "a", "Python", "module" ]
[ "\"Compile an FFI module into a Python module\"" ]
[ { "param": "name", "type": null }, { "param": "cdef", "type": null }, { "param": "code", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "cdef", "type": null, "docstring": null, "docstring_tokens": [...
b378c378b3e49c19c66e96c21fb22b7f7f227c2a
Kaedenn/b3sim
ffi/build.py
[ "BSD-2-Clause" ]
Python
special_xkeys_module
<not_specific>
def special_xkeys_module(): "Create a special X11/Xutil.h keys module" CDEF_LINE_FMT = "const int Key_{key};" CODE_LINE_FMT = "const int Key_{key} = {val}; /* XK_{key} */".strip() cdef_lines = [] code_lines = [] for line in open("/usr/include/X11/keysymdef.h"): if line.startswith("#define XK_"): t...
Create a special X11/Xutil.h keys module
Create a special X11/Xutil.h keys module
[ "Create", "a", "special", "X11", "/", "Xutil", ".", "h", "keys", "module" ]
def special_xkeys_module(): CDEF_LINE_FMT = "const int Key_{key};" CODE_LINE_FMT = "const int Key_{key} = {val}; /* XK_{key} */".strip() cdef_lines = [] code_lines = [] for line in open("/usr/include/X11/keysymdef.h"): if line.startswith("#define XK_"): tokens = line.strip().split() keyname, k...
[ "def", "special_xkeys_module", "(", ")", ":", "CDEF_LINE_FMT", "=", "\"const int Key_{key};\"", "CODE_LINE_FMT", "=", "\"const int Key_{key} = {val}; /* XK_{key} */\"", ".", "strip", "(", ")", "cdef_lines", "=", "[", "]", "code_lines", "=", "[", "]", "for", "line", ...
Create a special X11/Xutil.h keys module
[ "Create", "a", "special", "X11", "/", "Xutil", ".", "h", "keys", "module" ]
[ "\"Create a special X11/Xutil.h keys module\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
0bd9ee302bff24b97686bfeae915b1c1a3dc2a0e
Kaedenn/b3sim
pyb3.py
[ "BSD-2-Clause" ]
Python
funcToString
<not_specific>
def funcToString(func, *args, **kwargs): # {{{0 "Format a string representation of the function and arguments" try: name = func.__name__ except AttributeError as e: name = str(func) strs = [] for i in args: strs.append(repr(i)) for k,v in kwargs.items(): strs.append("{}={!r}".format(k, v)) ...
Format a string representation of the function and arguments
Format a string representation of the function and arguments
[ "Format", "a", "string", "representation", "of", "the", "function", "and", "arguments" ]
def funcToString(func, *args, **kwargs): try: name = func.__name__ except AttributeError as e: name = str(func) strs = [] for i in args: strs.append(repr(i)) for k,v in kwargs.items(): strs.append("{}={!r}".format(k, v)) return "{}({})".format(name, ", ".join(strs))
[ "def", "funcToString", "(", "func", ",", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "name", "=", "func", ".", "__name__", "except", "AttributeError", "as", "e", ":", "name", "=", "str", "(", "func", ")", "strs", "=", "[", "]", "for", ...
Format a string representation of the function and arguments
[ "Format", "a", "string", "representation", "of", "the", "function", "and", "arguments" ]
[ "# {{{0", "\"Format a string representation of the function and arguments\"" ]
[ { "param": "func", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
0bd9ee302bff24b97686bfeae915b1c1a3dc2a0e
Kaedenn/b3sim
pyb3.py
[ "BSD-2-Clause" ]
Python
ensurePybulletAPIs
null
def ensurePybulletAPIs(): # {{{0 "Ensure pybullet has all of the newly-added constants and functions" def _ensurePybulletProperty(name, val): # {{{1 "Ensure pybullet has the given attribute with the given value" logger = getLogger() if hasattr(pybullet, name): v = getattr(pybullet, name) if ...
Ensure pybullet has all of the newly-added constants and functions
Ensure pybullet has all of the newly-added constants and functions
[ "Ensure", "pybullet", "has", "all", "of", "the", "newly", "-", "added", "constants", "and", "functions" ]
def ensurePybulletAPIs(): def _ensurePybulletProperty(name, val): logger = getLogger() if hasattr(pybullet, name): v = getattr(pybullet, name) if v != val: logger.warning("pybullet[{!r}] == {} (not {})".format(name, v, val)) setattr(pybullet, name, val) _ensurePybulletProperty("MOU...
[ "def", "ensurePybulletAPIs", "(", ")", ":", "def", "_ensurePybulletProperty", "(", "name", ",", "val", ")", ":", "\"Ensure pybullet has the given attribute with the given value\"", "logger", "=", "getLogger", "(", ")", "if", "hasattr", "(", "pybullet", ",", "name", ...
Ensure pybullet has all of the newly-added constants and functions
[ "Ensure", "pybullet", "has", "all", "of", "the", "newly", "-", "added", "constants", "and", "functions" ]
[ "# {{{0", "\"Ensure pybullet has all of the newly-added constants and functions\"", "# {{{1", "\"Ensure pybullet has the given attribute with the given value\"", "# 1}}}", "# Ensure pybullet has the added constants", "# Add the rest of the keys using the xkeys FFI module, if available", "# Add the rem...
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
0bd9ee302bff24b97686bfeae915b1c1a3dc2a0e
Kaedenn/b3sim
pyb3.py
[ "BSD-2-Clause" ]
Python
_ensurePybulletProperty
null
def _ensurePybulletProperty(name, val): # {{{1 "Ensure pybullet has the given attribute with the given value" logger = getLogger() if hasattr(pybullet, name): v = getattr(pybullet, name) if v != val: logger.warning("pybullet[{!r}] == {} (not {})".format(name, v, val)) setattr(pybulle...
Ensure pybullet has the given attribute with the given value
Ensure pybullet has the given attribute with the given value
[ "Ensure", "pybullet", "has", "the", "given", "attribute", "with", "the", "given", "value" ]
def _ensurePybulletProperty(name, val): logger = getLogger() if hasattr(pybullet, name): v = getattr(pybullet, name) if v != val: logger.warning("pybullet[{!r}] == {} (not {})".format(name, v, val)) setattr(pybullet, name, val)
[ "def", "_ensurePybulletProperty", "(", "name", ",", "val", ")", ":", "logger", "=", "getLogger", "(", ")", "if", "hasattr", "(", "pybullet", ",", "name", ")", ":", "v", "=", "getattr", "(", "pybullet", ",", "name", ")", "if", "v", "!=", "val", ":", ...
Ensure pybullet has the given attribute with the given value
[ "Ensure", "pybullet", "has", "the", "given", "attribute", "with", "the", "given", "value" ]
[ "# {{{1", "\"Ensure pybullet has the given attribute with the given value\"" ]
[ { "param": "name", "type": null }, { "param": "val", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "val", "type": null, "docstring": null, "docstring_tokens": []...
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
_update
null
def _update(self, *args, **kwargs): # {{{1 "Assign a value to the vector" if len(args) == 0 and len(kwargs) == 0: self.x = 0 self.y = 0 self.z = 0 elif len(args) == 1: if isinstance(args[0], np.ndarray): self._update(*args[0]) elif isinstance(args[0], Vec): self...
Assign a value to the vector
Assign a value to the vector
[ "Assign", "a", "value", "to", "the", "vector" ]
def _update(self, *args, **kwargs): if len(args) == 0 and len(kwargs) == 0: self.x = 0 self.y = 0 self.z = 0 elif len(args) == 1: if isinstance(args[0], np.ndarray): self._update(*args[0]) elif isinstance(args[0], Vec): self._update(*tuple(args[0])) elif hasa...
[ "def", "_update", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "len", "(", "args", ")", "==", "0", "and", "len", "(", "kwargs", ")", "==", "0", ":", "self", ".", "x", "=", "0", "self", ".", "y", "=", "0", "self", ".",...
Assign a value to the vector
[ "Assign", "a", "value", "to", "the", "vector" ]
[ "# {{{1", "\"Assign a value to the vector\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
as_array
<not_specific>
def as_array(self, dtype=np.float32): # {{{1 "Create an np.array from the vector" if self._has_w: t = (self.x, self.y, self.z, self.w) else: t = (self.x, self.y, self.z) # Store to prevent gc crashes self._arr = np.array(t, dtype=dtype) return self._arr
Create an np.array from the vector
Create an np.array from the vector
[ "Create", "an", "np", ".", "array", "from", "the", "vector" ]
def as_array(self, dtype=np.float32): if self._has_w: t = (self.x, self.y, self.z, self.w) else: t = (self.x, self.y, self.z) self._arr = np.array(t, dtype=dtype) return self._arr
[ "def", "as_array", "(", "self", ",", "dtype", "=", "np", ".", "float32", ")", ":", "if", "self", ".", "_has_w", ":", "t", "=", "(", "self", ".", "x", ",", "self", ".", "y", ",", "self", ".", "z", ",", "self", ".", "w", ")", "else", ":", "t"...
Create an np.array from the vector
[ "Create", "an", "np", ".", "array", "from", "the", "vector" ]
[ "# {{{1", "\"Create an np.array from the vector\"", "# Store to prevent gc crashes" ]
[ { "param": "self", "type": null }, { "param": "dtype", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "dtype", "type": null, "docstring": null, "docstring_tokens": ...
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
rotate
<not_specific>
def rotate(self, axis, angle): # {{{1 "Rotate the vector by a given angle along a given axis" v = Vec(self) v.irotate(axis, angle) return v
Rotate the vector by a given angle along a given axis
Rotate the vector by a given angle along a given axis
[ "Rotate", "the", "vector", "by", "a", "given", "angle", "along", "a", "given", "axis" ]
def rotate(self, axis, angle): v = Vec(self) v.irotate(axis, angle) return v
[ "def", "rotate", "(", "self", ",", "axis", ",", "angle", ")", ":", "v", "=", "Vec", "(", "self", ")", "v", ".", "irotate", "(", "axis", ",", "angle", ")", "return", "v" ]
Rotate the vector by a given angle along a given axis
[ "Rotate", "the", "vector", "by", "a", "given", "angle", "along", "a", "given", "axis" ]
[ "# {{{1", "\"Rotate the vector by a given angle along a given axis\"" ]
[ { "param": "self", "type": null }, { "param": "axis", "type": null }, { "param": "angle", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "axis", "type": null, "docstring": null, "docstring_tokens": [...
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
angle
<not_specific>
def angle(self, other): # {{{1 "Return the quaternion angle between self and other" if self._has_w: return 2.0 * np.math.acos(self.w) return 0
Return the quaternion angle between self and other
Return the quaternion angle between self and other
[ "Return", "the", "quaternion", "angle", "between", "self", "and", "other" ]
def angle(self, other): if self._has_w: return 2.0 * np.math.acos(self.w) return 0
[ "def", "angle", "(", "self", ",", "other", ")", ":", "if", "self", ".", "_has_w", ":", "return", "2.0", "*", "np", ".", "math", ".", "acos", "(", "self", ".", "w", ")", "return", "0" ]
Return the quaternion angle between self and other
[ "Return", "the", "quaternion", "angle", "between", "self", "and", "other" ]
[ "# {{{1", "\"Return the quaternion angle between self and other\"" ]
[ { "param": "self", "type": null }, { "param": "other", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "other", "type": null, "docstring": null, "docstring_tokens": ...
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
inverse
<not_specific>
def inverse(self): # TODO # {{{1 "Calculate the inverse of the vector or quaternion" if self._has_w: return Vec(-self.x, -self.y, -self.z, self.w) else: # TODO pass
Calculate the inverse of the vector or quaternion
Calculate the inverse of the vector or quaternion
[ "Calculate", "the", "inverse", "of", "the", "vector", "or", "quaternion" ]
def inverse(self): if self._has_w: return Vec(-self.x, -self.y, -self.z, self.w) else: pass
[ "def", "inverse", "(", "self", ")", ":", "if", "self", ".", "_has_w", ":", "return", "Vec", "(", "-", "self", ".", "x", ",", "-", "self", ".", "y", ",", "-", "self", ".", "z", ",", "self", ".", "w", ")", "else", ":", "pass" ]
Calculate the inverse of the vector or quaternion
[ "Calculate", "the", "inverse", "of", "the", "vector", "or", "quaternion" ]
[ "# TODO # {{{1", "\"Calculate the inverse of the vector or quaternion\"", "# TODO" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
absolute
<not_specific>
def absolute(self): # {{{1 "Return a vector with all components positive" v = Vec() v.x = abs(self.x) v.y = abs(self.y) v.z = abs(self.z) if self._has_w: v.w = abs(self.w) return v
Return a vector with all components positive
Return a vector with all components positive
[ "Return", "a", "vector", "with", "all", "components", "positive" ]
def absolute(self): v = Vec() v.x = abs(self.x) v.y = abs(self.y) v.z = abs(self.z) if self._has_w: v.w = abs(self.w) return v
[ "def", "absolute", "(", "self", ")", ":", "v", "=", "Vec", "(", ")", "v", ".", "x", "=", "abs", "(", "self", ".", "x", ")", "v", ".", "y", "=", "abs", "(", "self", ".", "y", ")", "v", ".", "z", "=", "abs", "(", "self", ".", "z", ")", ...
Return a vector with all components positive
[ "Return", "a", "vector", "with", "all", "components", "positive" ]
[ "# {{{1", "\"Return a vector with all components positive\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
694fae7d2e6b1112ef0dbc61e9a363b21c2c911f
Kaedenn/b3sim
ffi/vector.py
[ "BSD-2-Clause" ]
Python
_apply_op
<not_specific>
def _apply_op(self, op, other, swap=False): # {{{1 "Apply an operator to self and other" if isinstance(other, Vec): p1 = self.as_array() p2 = other.as_array() else: p1 = self.as_array() p2 = other if swap: p1, p2 = p2, p1 return Vec(op(p1, p2))
Apply an operator to self and other
Apply an operator to self and other
[ "Apply", "an", "operator", "to", "self", "and", "other" ]
def _apply_op(self, op, other, swap=False): if isinstance(other, Vec): p1 = self.as_array() p2 = other.as_array() else: p1 = self.as_array() p2 = other if swap: p1, p2 = p2, p1 return Vec(op(p1, p2))
[ "def", "_apply_op", "(", "self", ",", "op", ",", "other", ",", "swap", "=", "False", ")", ":", "if", "isinstance", "(", "other", ",", "Vec", ")", ":", "p1", "=", "self", ".", "as_array", "(", ")", "p2", "=", "other", ".", "as_array", "(", ")", ...
Apply an operator to self and other
[ "Apply", "an", "operator", "to", "self", "and", "other" ]
[ "# {{{1", "\"Apply an operator to self and other\"" ]
[ { "param": "self", "type": null }, { "param": "op", "type": null }, { "param": "other", "type": null }, { "param": "swap", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "op", "type": null, "docstring": null, "docstring_tokens": [],...
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
worldFloor
<not_specific>
def worldFloor(self): # {{{0 """ Returns a vector at the center of the world's floor (determined by the walls being centered about the origin) """ return V3(0, 0, -self._ws + self._wt)
Returns a vector at the center of the world's floor (determined by the walls being centered about the origin)
Returns a vector at the center of the world's floor (determined by the walls being centered about the origin)
[ "Returns", "a", "vector", "at", "the", "center", "of", "the", "world", "'", "s", "floor", "(", "determined", "by", "the", "walls", "being", "centered", "about", "the", "origin", ")" ]
def worldFloor(self): return V3(0, 0, -self._ws + self._wt)
[ "def", "worldFloor", "(", "self", ")", ":", "return", "V3", "(", "0", ",", "0", ",", "-", "self", ".", "_ws", "+", "self", ".", "_wt", ")" ]
Returns a vector at the center of the world's floor (determined by the walls being centered about the origin)
[ "Returns", "a", "vector", "at", "the", "center", "of", "the", "world", "'", "s", "floor", "(", "determined", "by", "the", "walls", "being", "centered", "about", "the", "origin", ")" ]
[ "# {{{0", "\"\"\"\n Returns a vector at the center of the world's floor (determined by the\n walls being centered about the origin)\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_addAxes
null
def _addAxes(self): # {{{0 "Draw axes at the world floor" for aname, avec in CAM_AXES.items(): pt = self.worldFloor() + 2*avec self.drawText(aname, pt, color=CAM_AXIS_COLORS[aname]) self.drawLine(self.worldFloor(), pt, color=CAM_AXIS_COLORS[aname])
Draw axes at the world floor
Draw axes at the world floor
[ "Draw", "axes", "at", "the", "world", "floor" ]
def _addAxes(self): for aname, avec in CAM_AXES.items(): pt = self.worldFloor() + 2*avec self.drawText(aname, pt, color=CAM_AXIS_COLORS[aname]) self.drawLine(self.worldFloor(), pt, color=CAM_AXIS_COLORS[aname])
[ "def", "_addAxes", "(", "self", ")", ":", "for", "aname", ",", "avec", "in", "CAM_AXES", ".", "items", "(", ")", ":", "pt", "=", "self", ".", "worldFloor", "(", ")", "+", "2", "*", "avec", "self", ".", "drawText", "(", "aname", ",", "pt", ",", ...
Draw axes at the world floor
[ "Draw", "axes", "at", "the", "world", "floor" ]
[ "# {{{0", "\"Draw axes at the world floor\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_addGrid
null
def _addGrid(self): # {{{0 "Draw a grid on the world floor" wm = self.worldSizeMax() for i in range(int(round(wm))): # Draw a line from (-wm, i) to (wm, i) p1 = self.worldFloor() + V3(-wm, i, 0) p2 = self.worldFloor() + V3(wm, i, 0) self.drawLine(p1, p2, color=C_NONE) # Draw a ...
Draw a grid on the world floor
Draw a grid on the world floor
[ "Draw", "a", "grid", "on", "the", "world", "floor" ]
def _addGrid(self): wm = self.worldSizeMax() for i in range(int(round(wm))): p1 = self.worldFloor() + V3(-wm, i, 0) p2 = self.worldFloor() + V3(wm, i, 0) self.drawLine(p1, p2, color=C_NONE) p1 = self.worldFloor() + V3(-wm, -i, 0) p2 = self.worldFloor() + V3(wm, -i, 0) self.d...
[ "def", "_addGrid", "(", "self", ")", ":", "wm", "=", "self", ".", "worldSizeMax", "(", ")", "for", "i", "in", "range", "(", "int", "(", "round", "(", "wm", ")", ")", ")", ":", "p1", "=", "self", ".", "worldFloor", "(", ")", "+", "V3", "(", "-...
Draw a grid on the world floor
[ "Draw", "a", "grid", "on", "the", "world", "floor" ]
[ "# {{{0", "\"Draw a grid on the world floor\"", "# Draw a line from (-wm, i) to (wm, i)", "# Draw a line from (-wm, -i) to (wm, -i)", "# Draw a line from (i, -wm) to (i, wm)", "# Draw a line from (-i, -wm) to (-i, wm)" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_addObjects
null
def _addObjects(self): # {{{0 "Add all configured objects to the world" scs = [EmptyPlaneScenario()] wantWalls = self.getArg("walls") wantBricks1 = self.getArg("bricks") or self.getArg("b1") wantBricks2 = self.getArg("b2") wantBricks3 = self.getArg("b3") wantProjectile = self.getArg("project...
Add all configured objects to the world
Add all configured objects to the world
[ "Add", "all", "configured", "objects", "to", "the", "world" ]
def _addObjects(self): scs = [EmptyPlaneScenario()] wantWalls = self.getArg("walls") wantBricks1 = self.getArg("bricks") or self.getArg("b1") wantBricks2 = self.getArg("b2") wantBricks3 = self.getArg("b3") wantProjectile = self.getArg("projectile") wantPit = self.getArg("pit") wantBunny...
[ "def", "_addObjects", "(", "self", ")", ":", "scs", "=", "[", "EmptyPlaneScenario", "(", ")", "]", "wantWalls", "=", "self", ".", "getArg", "(", "\"walls\"", ")", "wantBricks1", "=", "self", ".", "getArg", "(", "\"bricks\"", ")", "or", "self", ".", "ge...
Add all configured objects to the world
[ "Add", "all", "configured", "objects", "to", "the", "world" ]
[ "# {{{0", "\"Add all configured objects to the world\"", "# Add all of the objects from all of the scenarios configured", "# Handle --urdf argument: add URDF at a random position between (-0.5, 0.5)", "# Handle --sb argument: add soft bodies", "# Handle --rb argument: add rigid bodies", "# Add non-body ...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
dropBody
null
def dropBody(self): # {{{0 "Drop an object onto the pile of things" m = self.objectMass() * 100 r = 0.5 z = self.worldSize() - 4*self.wallThickness() - 2*r self._bodies.add(self.createSphere(m, V3(0, 0, z), radius=r))
Drop an object onto the pile of things
Drop an object onto the pile of things
[ "Drop", "an", "object", "onto", "the", "pile", "of", "things" ]
def dropBody(self): m = self.objectMass() * 100 r = 0.5 z = self.worldSize() - 4*self.wallThickness() - 2*r self._bodies.add(self.createSphere(m, V3(0, 0, z), radius=r))
[ "def", "dropBody", "(", "self", ")", ":", "m", "=", "self", ".", "objectMass", "(", ")", "*", "100", "r", "=", "0.5", "z", "=", "self", ".", "worldSize", "(", ")", "-", "4", "*", "self", ".", "wallThickness", "(", ")", "-", "2", "*", "r", "se...
Drop an object onto the pile of things
[ "Drop", "an", "object", "onto", "the", "pile", "of", "things" ]
[ "# {{{0", "\"Drop an object onto the pile of things\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
fireProjectile
<not_specific>
def fireProjectile(self, **kwargs): # {{{0 """Fire a projectile in the direction the camera is facing size: Projectile size; defaults to self.getSlider("Projectile Size") mass: Projectile mass; defaults to self.getSlider("Projectile Mass") vel: Projectile velocity (vector) pos: Projectile starting ...
Fire a projectile in the direction the camera is facing size: Projectile size; defaults to self.getSlider("Projectile Size") mass: Projectile mass; defaults to self.getSlider("Projectile Mass") vel: Projectile velocity (vector) pos: Projectile starting position (vector) Projectile velocity default...
Fire a projectile in the direction the camera is facing size: Projectile size; defaults to self.getSlider("Projectile Size") mass: Projectile mass; defaults to self.getSlider("Projectile Mass") vel: Projectile velocity (vector) pos: Projectile starting position (vector) Projectile velocity defaults at self.getSlider("...
[ "Fire", "a", "projectile", "in", "the", "direction", "the", "camera", "is", "facing", "size", ":", "Projectile", "size", ";", "defaults", "to", "self", ".", "getSlider", "(", "\"", "Projectile", "Size", "\"", ")", "mass", ":", "Projectile", "mass", ";", ...
def fireProjectile(self, **kwargs): ci = self.getCamera() size = kwargs.get("size", self.getSlider("Projectile Size")) mass = kwargs.get("mass", self.getSlider("Projectile Mass")) if "vel" in kwargs: vel = kwargs["vel"] else: vel = ci["camForward"] * self.getSlider("Particle Speed") ...
[ "def", "fireProjectile", "(", "self", ",", "**", "kwargs", ")", ":", "ci", "=", "self", ".", "getCamera", "(", ")", "size", "=", "kwargs", ".", "get", "(", "\"size\"", ",", "self", ".", "getSlider", "(", "\"Projectile Size\"", ")", ")", "mass", "=", ...
Fire a projectile in the direction the camera is facing size: Projectile size; defaults to self.getSlider("Projectile Size") mass: Projectile mass; defaults to self.getSlider("Projectile Mass") vel: Projectile velocity (vector) pos: Projectile starting position (vector)
[ "Fire", "a", "projectile", "in", "the", "direction", "the", "camera", "is", "facing", "size", ":", "Projectile", "size", ";", "defaults", "to", "self", ".", "getSlider", "(", "\"", "Projectile", "Size", "\"", ")", "mass", ":", "Projectile", "mass", ";", ...
[ "# {{{0", "\"\"\"Fire a projectile in the direction the camera is facing\n\n size: Projectile size; defaults to self.getSlider(\"Projectile Size\")\n mass: Projectile mass; defaults to self.getSlider(\"Projectile Mass\")\n vel: Projectile velocity (vector)\n pos: Projectile starting position (vector)\...
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
addRandomUrdf
null
def addRandomUrdf(self): # {{{0 "Add a random URDF to the simulation" f = pyb3.getRandomUrdf() if f: scale = self.getSlider("URDF Size") logger.debug("Adding random URDF: {} (scale {})".format(f, scale)) self.loadURDF(f, basePosition=randomVec(), globalScaling=scale) else: logger...
Add a random URDF to the simulation
Add a random URDF to the simulation
[ "Add", "a", "random", "URDF", "to", "the", "simulation" ]
def addRandomUrdf(self): f = pyb3.getRandomUrdf() if f: scale = self.getSlider("URDF Size") logger.debug("Adding random URDF: {} (scale {})".format(f, scale)) self.loadURDF(f, basePosition=randomVec(), globalScaling=scale) else: logger.error("Failed to add random URDF")
[ "def", "addRandomUrdf", "(", "self", ")", ":", "f", "=", "pyb3", ".", "getRandomUrdf", "(", ")", "if", "f", ":", "scale", "=", "self", ".", "getSlider", "(", "\"URDF Size\"", ")", "logger", ".", "debug", "(", "\"Adding random URDF: {} (scale {})\"", ".", "...
Add a random URDF to the simulation
[ "Add", "a", "random", "URDF", "to", "the", "simulation" ]
[ "# {{{0", "\"Add a random URDF to the simulation\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
loadUrdf
null
def loadUrdf(self): # {{{0 "Present an open-file dialog for loading a URDF object" objs = openFileDialog(title="Select object file(s)...", globs=("URDF (*.urdf)|*.urdf",), multiple=True) logger.debug("Loading objects: {!r}".format(objs)) scale = self.g...
Present an open-file dialog for loading a URDF object
Present an open-file dialog for loading a URDF object
[ "Present", "an", "open", "-", "file", "dialog", "for", "loading", "a", "URDF", "object" ]
def loadUrdf(self): objs = openFileDialog(title="Select object file(s)...", globs=("URDF (*.urdf)|*.urdf",), multiple=True) logger.debug("Loading objects: {!r}".format(objs)) scale = self.getSlider("URDF Size") for obj in objs: pos = randomVec()...
[ "def", "loadUrdf", "(", "self", ")", ":", "objs", "=", "openFileDialog", "(", "title", "=", "\"Select object file(s)...\"", ",", "globs", "=", "(", "\"URDF (*.urdf)|*.urdf\"", ",", ")", ",", "multiple", "=", "True", ")", "logger", ".", "debug", "(", "\"Loadi...
Present an open-file dialog for loading a URDF object
[ "Present", "an", "open", "-", "file", "dialog", "for", "loading", "a", "URDF", "object" ]
[ "# {{{0", "\"Present an open-file dialog for loading a URDF object\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
onMovementKey
<not_specific>
def onMovementKey(app, keys): # {{{0 "Handle pressing one of the movement keys" # Rules that define what keys do what movementRules = { # {{{1 CAM_AXIS_PITCH: { "enable": anyPressed(keys, "C-Up", "C-Down") \ and isPressed(keys, p.B3G_CONTROL), "stepArgName": "cdp", "dir": ("Up", "D...
Handle pressing one of the movement keys
Handle pressing one of the movement keys
[ "Handle", "pressing", "one", "of", "the", "movement", "keys" ]
def onMovementKey(app, keys): movementRules = { CAM_AXIS_PITCH: { "enable": anyPressed(keys, "C-Up", "C-Down") \ and isPressed(keys, p.B3G_CONTROL), "stepArgName": "cdp", "dir": ("Up", "Down"), "enableFast": False }, CAM_AXIS_YAW: { "enable": anyPressed(keys, "Lef...
[ "def", "onMovementKey", "(", "app", ",", "keys", ")", ":", "movementRules", "=", "{", "CAM_AXIS_PITCH", ":", "{", "\"enable\"", ":", "anyPressed", "(", "keys", ",", "\"C-Up\"", ",", "\"C-Down\"", ")", "and", "isPressed", "(", "keys", ",", "p", ".", "B3G_...
Handle pressing one of the movement keys
[ "Handle", "pressing", "one", "of", "the", "movement", "keys" ]
[ "# {{{0", "\"Handle pressing one of the movement keys\"", "# Rules that define what keys do what", "# {{{1", "# 1}}}", "# {{{1", "\"Determine if we go positive or negative\"", "# 1}}}", "# Handle generic movement keys", "# Special movement keys", "# S-NUMPAD_5 resets the camera to the starting p...
[ { "param": "app", "type": null }, { "param": "keys", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "app", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "keys", "type": null, "docstring": null, "docstring_tokens": []...
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_gatherBulletArgs
<not_specific>
def _gatherBulletArgs(self): # {{{0 "Gather the arguments to pass to pybullet.connect" # Determine background color arguments cr = cg = cb = None if self.args.bgr is not None: cr = self.args.bgr if self.args.bgg is not None: cg = self.args.bgg if self.args.bgb is not None: cb =...
Gather the arguments to pass to pybullet.connect
Gather the arguments to pass to pybullet.connect
[ "Gather", "the", "arguments", "to", "pass", "to", "pybullet", ".", "connect" ]
def _gatherBulletArgs(self): cr = cg = cb = None if self.args.bgr is not None: cr = self.args.bgr if self.args.bgg is not None: cg = self.args.bgg if self.args.bgb is not None: cb = self.args.bgb if self.args.bg: crgba = parseColor(self.args.bg, cmax=255, scale=255) if...
[ "def", "_gatherBulletArgs", "(", "self", ")", ":", "cr", "=", "cg", "=", "cb", "=", "None", "if", "self", ".", "args", ".", "bgr", "is", "not", "None", ":", "cr", "=", "self", ".", "args", ".", "bgr", "if", "self", ".", "args", ".", "bgg", "is"...
Gather the arguments to pass to pybullet.connect
[ "Gather", "the", "arguments", "to", "pass", "to", "pybullet", ".", "connect" ]
[ "# {{{0", "\"Gather the arguments to pass to pybullet.connect\"", "# Determine background color arguments", "# Determine the arguments to pass to pybullet.connect" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_gatherSimArgs
<not_specific>
def _gatherSimArgs(self): # {{{0 "Gather the arguments to pass to the simulation" extraKwargs = {} # Gather arguments from --config if self.args.config is not None: for val in self.args.config: if "=" in val: k, v = val.split("=", 1) extraKwargs[k] = v else: ...
Gather the arguments to pass to the simulation
Gather the arguments to pass to the simulation
[ "Gather", "the", "arguments", "to", "pass", "to", "the", "simulation" ]
def _gatherSimArgs(self): extraKwargs = {} if self.args.config is not None: for val in self.args.config: if "=" in val: k, v = val.split("=", 1) extraKwargs[k] = v else: extraKwargs[val] = True if self.args.debug: extraKwargs["debug"] = True if ...
[ "def", "_gatherSimArgs", "(", "self", ")", ":", "extraKwargs", "=", "{", "}", "if", "self", ".", "args", ".", "config", "is", "not", "None", ":", "for", "val", "in", "self", ".", "args", ".", "config", ":", "if", "\"=\"", "in", "val", ":", "k", "...
Gather the arguments to pass to the simulation
[ "Gather", "the", "arguments", "to", "pass", "to", "the", "simulation" ]
[ "# {{{0", "\"Gather the arguments to pass to the simulation\"", "# Gather arguments from --config", "# Gather general simulation arguments", "# Gather engine parameters", "# Print configuration for debugging" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_setupKeyBinds
<not_specific>
def _setupKeyBinds(self): # {{{0 "Create the keypress manager and register keypress events" kbm = KeyPressManager(self.app, debug=self.args.debug) # TODO: Detect these and others using X11 kbm.map("!", "S-1") kbm.map("?", "S-/") onMove = lambda keys: onMovementKey(self.app, keys) for key in ...
Create the keypress manager and register keypress events
Create the keypress manager and register keypress events
[ "Create", "the", "keypress", "manager", "and", "register", "keypress", "events" ]
def _setupKeyBinds(self): kbm = KeyPressManager(self.app, debug=self.args.debug) kbm.map("!", "S-1") kbm.map("?", "S-/") onMove = lambda keys: onMovementKey(self.app, keys) for key in KEY_CLASS_ARROWS + KEY_CLASS_NUMPAD: kbm.bind(key, onMove, keys=True, repeat=True) kbm.bind(" ", self._on...
[ "def", "_setupKeyBinds", "(", "self", ")", ":", "kbm", "=", "KeyPressManager", "(", "self", ".", "app", ",", "debug", "=", "self", ".", "args", ".", "debug", ")", "kbm", ".", "map", "(", "\"!\"", ",", "\"S-1\"", ")", "kbm", ".", "map", "(", "\"?\""...
Create the keypress manager and register keypress events
[ "Create", "the", "keypress", "manager", "and", "register", "keypress", "events" ]
[ "# {{{0", "\"Create the keypress manager and register keypress events\"", "# TODO: Detect these and others using X11", "# Debugging: simulate a Bullet error", "# Results in pybullet.error" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_loop
null
def _loop(self): # {{{0 "Main loop: process key events, mouse events, and changes to GUI settings" tickCounter = 0 startTime = monotonic() getTickTime = lambda f: startTime + INPUT_SLEEP * f try: while self.app.isConnected(): tickCounter += 1 # Handle key events with se...
Main loop: process key events, mouse events, and changes to GUI settings
Main loop: process key events, mouse events, and changes to GUI settings
[ "Main", "loop", ":", "process", "key", "events", "mouse", "events", "and", "changes", "to", "GUI", "settings" ]
def _loop(self): tickCounter = 0 startTime = monotonic() getTickTime = lambda f: startTime + INPUT_SLEEP * f try: while self.app.isConnected(): tickCounter += 1 with self.kbm: if self.args.debug: self.kbm.debugDumpKeys() if self.args.debug: ...
[ "def", "_loop", "(", "self", ")", ":", "tickCounter", "=", "0", "startTime", "=", "monotonic", "(", ")", "getTickTime", "=", "lambda", "f", ":", "startTime", "+", "INPUT_SLEEP", "*", "f", "try", ":", "while", "self", ".", "app", ".", "isConnected", "("...
Main loop: process key events, mouse events, and changes to GUI settings
[ "Main", "loop", ":", "process", "key", "events", "mouse", "events", "and", "changes", "to", "GUI", "settings" ]
[ "# {{{0", "\"Main loop: process key events, mouse events, and changes to GUI settings\"", "# Handle key events", "# Handle mouse events", "# Update continuous variables", "# Sleep until the next tick" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_onKeyFireProjectile
null
def _onKeyFireProjectile(self, keys=()): # {{{0 "Callback: fire projectile(s) in the direction the camera is facing" ci = self.app.getCamera() cpos = self.app.getCameraPos() posStart = cpos + 8 * ci["camForward"] vz = ci["camUp"] vy = ci["camForward"] vx = np.cross(vy, vz) if p.B3G_SHIFT...
Callback: fire projectile(s) in the direction the camera is facing
fire projectile(s) in the direction the camera is facing
[ "fire", "projectile", "(", "s", ")", "in", "the", "direction", "the", "camera", "is", "facing" ]
def _onKeyFireProjectile(self, keys=()): ci = self.app.getCamera() cpos = self.app.getCameraPos() posStart = cpos + 8 * ci["camForward"] vz = ci["camUp"] vy = ci["camForward"] vx = np.cross(vy, vz) if p.B3G_SHIFT in keys: psize = self.app.getSlider("Projectile Size") * 0.5 dxs =...
[ "def", "_onKeyFireProjectile", "(", "self", ",", "keys", "=", "(", ")", ")", ":", "ci", "=", "self", ".", "app", ".", "getCamera", "(", ")", "cpos", "=", "self", ".", "app", ".", "getCameraPos", "(", ")", "posStart", "=", "cpos", "+", "8", "*", "...
Callback: fire projectile(s) in the direction the camera is facing
[ "Callback", ":", "fire", "projectile", "(", "s", ")", "in", "the", "direction", "the", "camera", "is", "facing" ]
[ "# {{{0", "\"Callback: fire projectile(s) in the direction the camera is facing\"" ]
[ { "param": "self", "type": null }, { "param": "keys", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "keys", "type": null, "docstring": null, "docstring_tokens": [...
fd8c676af226f296790031547743cb43b9604df7
Kaedenn/b3sim
simulation.py
[ "BSD-2-Clause" ]
Python
_onKeyVideoLogging
null
def _onKeyVideoLogging(self): # {{{0 "Start (or stop) dumping simulation to a file" if self.export is None: path = self._getVideoPath() self.export = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4, path) p.b3Print("Rendering simulation to {}".format(path)) else: p.stopStateLogging(sel...
Start (or stop) dumping simulation to a file
Start (or stop) dumping simulation to a file
[ "Start", "(", "or", "stop", ")", "dumping", "simulation", "to", "a", "file" ]
def _onKeyVideoLogging(self): if self.export is None: path = self._getVideoPath() self.export = p.startStateLogging(p.STATE_LOGGING_VIDEO_MP4, path) p.b3Print("Rendering simulation to {}".format(path)) else: p.stopStateLogging(self.export) self.export = None p.b3Print("Rende...
[ "def", "_onKeyVideoLogging", "(", "self", ")", ":", "if", "self", ".", "export", "is", "None", ":", "path", "=", "self", ".", "_getVideoPath", "(", ")", "self", ".", "export", "=", "p", ".", "startStateLogging", "(", "p", ".", "STATE_LOGGING_VIDEO_MP4", ...
Start (or stop) dumping simulation to a file
[ "Start", "(", "or", "stop", ")", "dumping", "simulation", "to", "a", "file" ]
[ "# {{{0", "\"Start (or stop) dumping simulation to a file\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
isPressed
<not_specific>
def isPressed(keys, key, states=KEY_ANY_STATE, modifiers=()): # {{{0 "Return True if an event exists for the given key" code, mods = parseKey(key) pressed = ((keys.get(code, 0) & states) != 0) # Ensure all modifiers are present, regardless of value for m in set(modifiers).union(set(mods)): if m not in key...
Return True if an event exists for the given key
Return True if an event exists for the given key
[ "Return", "True", "if", "an", "event", "exists", "for", "the", "given", "key" ]
def isPressed(keys, key, states=KEY_ANY_STATE, modifiers=()): code, mods = parseKey(key) pressed = ((keys.get(code, 0) & states) != 0) for m in set(modifiers).union(set(mods)): if m not in keys: return False return pressed
[ "def", "isPressed", "(", "keys", ",", "key", ",", "states", "=", "KEY_ANY_STATE", ",", "modifiers", "=", "(", ")", ")", ":", "code", ",", "mods", "=", "parseKey", "(", "key", ")", "pressed", "=", "(", "(", "keys", ".", "get", "(", "code", ",", "0...
Return True if an event exists for the given key
[ "Return", "True", "if", "an", "event", "exists", "for", "the", "given", "key" ]
[ "# {{{0", "\"Return True if an event exists for the given key\"", "# Ensure all modifiers are present, regardless of value" ]
[ { "param": "keys", "type": null }, { "param": "key", "type": null }, { "param": "states", "type": null }, { "param": "modifiers", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "keys", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": null, "docstring_tokens": []...
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
anyPressed
<not_specific>
def anyPressed(keys, *keysToCheck): # {{{0 "Return True if any of the keys have events" for k in keysToCheck: if isPressed(keys, k): return True return False
Return True if any of the keys have events
Return True if any of the keys have events
[ "Return", "True", "if", "any", "of", "the", "keys", "have", "events" ]
def anyPressed(keys, *keysToCheck): for k in keysToCheck: if isPressed(keys, k): return True return False
[ "def", "anyPressed", "(", "keys", ",", "*", "keysToCheck", ")", ":", "for", "k", "in", "keysToCheck", ":", "if", "isPressed", "(", "keys", ",", "k", ")", ":", "return", "True", "return", "False" ]
Return True if any of the keys have events
[ "Return", "True", "if", "any", "of", "the", "keys", "have", "events" ]
[ "# {{{0", "\"Return True if any of the keys have events\"" ]
[ { "param": "keys", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "keys", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
_verifyKeysAttr
<not_specific>
def _verifyKeysAttr(func): # {{{0 "Decorator: verify self._keys is not None" @functools.wraps(func) def wrappedFunc(self, *args, **kwargs): if self._keys is not None: return func(self, *args, **kwargs) return wrappedFunc
Decorator: verify self._keys is not None
verify self._keys is not None
[ "verify", "self", ".", "_keys", "is", "not", "None" ]
def _verifyKeysAttr(func): @functools.wraps(func) def wrappedFunc(self, *args, **kwargs): if self._keys is not None: return func(self, *args, **kwargs) return wrappedFunc
[ "def", "_verifyKeysAttr", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "wrappedFunc", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "_keys", "is", "not", "None", ":", "return", "...
Decorator: verify self._keys is not None
[ "Decorator", ":", "verify", "self", ".", "_keys", "is", "not", "None" ]
[ "# {{{0", "\"Decorator: verify self._keys is not None\"" ]
[ { "param": "func", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "func", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
_stateGetter
<not_specific>
def _stateGetter(*states): # {{{0 "Decorator: key state getter: return whether or not key is in states" def decoratorFunc(func): @functools.wraps(func) def getterFunc(self, key): if self._keys is not None: return self._keys.get(key, None) in states return getterFunc return decoratorFunc
Decorator: key state getter: return whether or not key is in states
key state getter: return whether or not key is in states
[ "key", "state", "getter", ":", "return", "whether", "or", "not", "key", "is", "in", "states" ]
def _stateGetter(*states): def decoratorFunc(func): @functools.wraps(func) def getterFunc(self, key): if self._keys is not None: return self._keys.get(key, None) in states return getterFunc return decoratorFunc
[ "def", "_stateGetter", "(", "*", "states", ")", ":", "def", "decoratorFunc", "(", "func", ")", ":", "@", "functools", ".", "wraps", "(", "func", ")", "def", "getterFunc", "(", "self", ",", "key", ")", ":", "if", "self", ".", "_keys", "is", "not", "...
Decorator: key state getter: return whether or not key is in states
[ "Decorator", ":", "key", "state", "getter", ":", "return", "whether", "or", "not", "key", "is", "in", "states" ]
[ "# {{{0", "\"Decorator: key state getter: return whether or not key is in states\"" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
bind
null
def bind(self, key, func, # {{{1 timeout=0, keys=None, on=p.KEY_WAS_TRIGGERED, repeat=False, modifiers=(), args=None, kwargs=None): """Bind a key to a function. Arguments: key The key code to listen for; may be either a string or a code ...
Bind a key to a function. Arguments: key The key code to listen for; may be either a string or a code func The function to call timeout Time in seconds to ignore repeated key presses (default 0) keys Pass the keys dict as the first arg to func (default False) on Bi...
Bind a key to a function. Arguments: key The key code to listen for; may be either a string or a code func The function to call timeout Time in seconds to ignore repeated key presses (default 0) keys Pass the keys dict as the first arg to func (default False) on Bit mask of required k...
[ "Bind", "a", "key", "to", "a", "function", ".", "Arguments", ":", "key", "The", "key", "code", "to", "listen", "for", ";", "may", "be", "either", "a", "string", "or", "a", "code", "func", "The", "function", "to", "call", "timeout", "Time", "in", "sec...
def bind(self, key, func, timeout=0, keys=None, on=p.KEY_WAS_TRIGGERED, repeat=False, modifiers=(), args=None, kwargs=None): fArgs = [] fKwargs = {} if args is not None: fArgs.extend(args) if kwargs is not None: fKwargs.updat...
[ "def", "bind", "(", "self", ",", "key", ",", "func", ",", "timeout", "=", "0", ",", "keys", "=", "None", ",", "on", "=", "p", ".", "KEY_WAS_TRIGGERED", ",", "repeat", "=", "False", ",", "modifiers", "=", "(", ")", ",", "args", "=", "None", ",", ...
Bind a key to a function.
[ "Bind", "a", "key", "to", "a", "function", "." ]
[ "# {{{1", "\"\"\"Bind a key to a function. Arguments:\n key The key code to listen for; may be either a string or a code\n func The function to call\n timeout Time in seconds to ignore repeated key presses (default 0)\n keys Pass the keys dict as the first arg to func (defaul...
[ { "param": "self", "type": null }, { "param": "key", "type": null }, { "param": "func", "type": null }, { "param": "timeout", "type": null }, { "param": "keys", "type": null }, { "param": "on", "type": null }, { "param": "repeat", "type...
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "key", "type": null, "docstring": null, "docstring_tokens": []...
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
kbToString
<not_specific>
def kbToString(self, kb): # {{{1 "Convert a kb dict to a string" s = "{} ".format(kb["key"]) if kb["modifiers"]: s += "+".join(getKeyName(m) for m in kb["modifiers"]) + "+" s += getKeyName(kb["key"]) s += " on {}".format(getKeyStateString(kb["states"])) if kb["timeout"]: s += " timeo...
Convert a kb dict to a string
Convert a kb dict to a string
[ "Convert", "a", "kb", "dict", "to", "a", "string" ]
def kbToString(self, kb): s = "{} ".format(kb["key"]) if kb["modifiers"]: s += "+".join(getKeyName(m) for m in kb["modifiers"]) + "+" s += getKeyName(kb["key"]) s += " on {}".format(getKeyStateString(kb["states"])) if kb["timeout"]: s += " timeout {}".format(kb["timeout"]) try: ...
[ "def", "kbToString", "(", "self", ",", "kb", ")", ":", "s", "=", "\"{} \"", ".", "format", "(", "kb", "[", "\"key\"", "]", ")", "if", "kb", "[", "\"modifiers\"", "]", ":", "s", "+=", "\"+\"", ".", "join", "(", "getKeyName", "(", "m", ")", "for", ...
Convert a kb dict to a string
[ "Convert", "a", "kb", "dict", "to", "a", "string" ]
[ "# {{{1", "\"Convert a kb dict to a string\"" ]
[ { "param": "self", "type": null }, { "param": "kb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kb", "type": null, "docstring": null, "docstring_tokens": [],...
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
beginRegion
null
def beginRegion(self): # {{{1 "Start current round of key press handling" self._keys = p.getKeyboardEvents() # Handle keybinds for kb in self._binds: if isPressed(self._keys, kb["key"], kb["states"], kb["modifiers"]): if monotonic() - kb["lastPress"] >= kb["timeout"]: self._callB...
Start current round of key press handling
Start current round of key press handling
[ "Start", "current", "round", "of", "key", "press", "handling" ]
def beginRegion(self): self._keys = p.getKeyboardEvents() for kb in self._binds: if isPressed(self._keys, kb["key"], kb["states"], kb["modifiers"]): if monotonic() - kb["lastPress"] >= kb["timeout"]: self._callBoundFunc(kb) kb["lastPress"] = monotonic()
[ "def", "beginRegion", "(", "self", ")", ":", "self", ".", "_keys", "=", "p", ".", "getKeyboardEvents", "(", ")", "for", "kb", "in", "self", ".", "_binds", ":", "if", "isPressed", "(", "self", ".", "_keys", ",", "kb", "[", "\"key\"", "]", ",", "kb",...
Start current round of key press handling
[ "Start", "current", "round", "of", "key", "press", "handling" ]
[ "# {{{1", "\"Start current round of key press handling\"", "# Handle keybinds" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2ad55a111b229179d0d7e0ba5090638fc4048df7
Kaedenn/b3sim
keypressmgr.py
[ "BSD-2-Clause" ]
Python
_callBoundFunc
<not_specific>
def _callBoundFunc(self, kb): # {{{1 "Private: call the function defined in the keybind object" wantKeys = False if kb["wantKeyInfo"] in (True, False): wantKeys = kb["wantKeyInfo"] func = kb["func"] funcArgs = [self._keys] if wantKeys else [] funcKwargs = {} funcArgs.extend(kb["extraAr...
Private: call the function defined in the keybind object
call the function defined in the keybind object
[ "call", "the", "function", "defined", "in", "the", "keybind", "object" ]
def _callBoundFunc(self, kb): wantKeys = False if kb["wantKeyInfo"] in (True, False): wantKeys = kb["wantKeyInfo"] func = kb["func"] funcArgs = [self._keys] if wantKeys else [] funcKwargs = {} funcArgs.extend(kb["extraArgs"]) funcKwargs.update(kb["extraKwargs"]) if self._debug: ...
[ "def", "_callBoundFunc", "(", "self", ",", "kb", ")", ":", "wantKeys", "=", "False", "if", "kb", "[", "\"wantKeyInfo\"", "]", "in", "(", "True", ",", "False", ")", ":", "wantKeys", "=", "kb", "[", "\"wantKeyInfo\"", "]", "func", "=", "kb", "[", "\"fu...
Private: call the function defined in the keybind object
[ "Private", ":", "call", "the", "function", "defined", "in", "the", "keybind", "object" ]
[ "# {{{1", "\"Private: call the function defined in the keybind object\"" ]
[ { "param": "self", "type": null }, { "param": "kb", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "kb", "type": null, "docstring": null, "docstring_tokens": [],...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
_or
<not_specific>
def _or(v, d): # {{{0 "Either v or d, whichever is not None first" if v is not None: return v return d
Either v or d, whichever is not None first
Either v or d, whichever is not None first
[ "Either", "v", "or", "d", "whichever", "is", "not", "None", "first" ]
def _or(v, d): if v is not None: return v return d
[ "def", "_or", "(", "v", ",", "d", ")", ":", "if", "v", "is", "not", "None", ":", "return", "v", "return", "d" ]
Either v or d, whichever is not None first
[ "Either", "v", "or", "d", "whichever", "is", "not", "None", "first" ]
[ "# {{{0", "\"Either v or d, whichever is not None first\"" ]
[ { "param": "v", "type": null }, { "param": "d", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "v", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "d", "type": null, "docstring": null, "docstring_tokens": [], ...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
connect
<not_specific>
def connect(self, args=None): # {{{1 "Start the shared memory server and GUI client" # Collect arguments to pass to connect() def parseArgObj(argobj): if isinstance(argobj, basestring): return argobj.split() elif argobj: return argobj return [] cargs = [] cargs.exte...
Start the shared memory server and GUI client
Start the shared memory server and GUI client
[ "Start", "the", "shared", "memory", "server", "and", "GUI", "client" ]
def connect(self, args=None): def parseArgObj(argobj): if isinstance(argobj, basestring): return argobj.split() elif argobj: return argobj return [] cargs = [] cargs.extend(parseArgObj(self._connectArgs)) cargs.extend(parseArgObj(args)) cargs = " ".join(cargs) ...
[ "def", "connect", "(", "self", ",", "args", "=", "None", ")", ":", "def", "parseArgObj", "(", "argobj", ")", ":", "if", "isinstance", "(", "argobj", ",", "basestring", ")", ":", "return", "argobj", ".", "split", "(", ")", "elif", "argobj", ":", "retu...
Start the shared memory server and GUI client
[ "Start", "the", "shared", "memory", "server", "and", "GUI", "client" ]
[ "# {{{1", "\"Start the shared memory server and GUI client\"", "# Collect arguments to pass to connect()", "# Start and connect to server", "# Add standard debug config sliders" ]
[ { "param": "self", "type": null }, { "param": "args", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "args", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
resetButton
null
def resetButton(self, name): # {{{1 "Reset a button to un-triggered" try: p.resetUserDebugButton(self._debugConfigs[name]) except NotImplementedError as e: logger.error(e) except p.error as e: logger.error(e)
Reset a button to un-triggered
Reset a button to un-triggered
[ "Reset", "a", "button", "to", "un", "-", "triggered" ]
def resetButton(self, name): try: p.resetUserDebugButton(self._debugConfigs[name]) except NotImplementedError as e: logger.error(e) except p.error as e: logger.error(e)
[ "def", "resetButton", "(", "self", ",", "name", ")", ":", "try", ":", "p", ".", "resetUserDebugButton", "(", "self", ".", "_debugConfigs", "[", "name", "]", ")", "except", "NotImplementedError", "as", "e", ":", "logger", ".", "error", "(", "e", ")", "e...
Reset a button to un-triggered
[ "Reset", "a", "button", "to", "un", "-", "triggered" ]
[ "# {{{1", "\"Reset a button to un-triggered\"" ]
[ { "param": "self", "type": null }, { "param": "name", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "name", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
drawText
null
def drawText(self, t, pt, size=None, color=C3_BLK): # {{{1 "Draw text at the given point" kwargs = {} kwargs["textColorRGB"] = color if size is not None: kwargs["textSize"] = size p.addUserDebugText(t, pt, **kwargs)
Draw text at the given point
Draw text at the given point
[ "Draw", "text", "at", "the", "given", "point" ]
def drawText(self, t, pt, size=None, color=C3_BLK): kwargs = {} kwargs["textColorRGB"] = color if size is not None: kwargs["textSize"] = size p.addUserDebugText(t, pt, **kwargs)
[ "def", "drawText", "(", "self", ",", "t", ",", "pt", ",", "size", "=", "None", ",", "color", "=", "C3_BLK", ")", ":", "kwargs", "=", "{", "}", "kwargs", "[", "\"textColorRGB\"", "]", "=", "color", "if", "size", "is", "not", "None", ":", "kwargs", ...
Draw text at the given point
[ "Draw", "text", "at", "the", "given", "point" ]
[ "# {{{1", "\"Draw text at the given point\"" ]
[ { "param": "self", "type": null }, { "param": "t", "type": null }, { "param": "pt", "type": null }, { "param": "size", "type": null }, { "param": "color", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "t", "type": null, "docstring": null, "docstring_tokens": [], ...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
tick
null
def tick(self): # {{{0 "Process main-loop events: gravity, button functions, etc" self.updateGravity() for bname in self._buttons: if self.getButton(bname): self._buttons[bname]["func"]() self.resetButton(bname)
Process main-loop events: gravity, button functions, etc
Process main-loop events: gravity, button functions, etc
[ "Process", "main", "-", "loop", "events", ":", "gravity", "button", "functions", "etc" ]
def tick(self): self.updateGravity() for bname in self._buttons: if self.getButton(bname): self._buttons[bname]["func"]() self.resetButton(bname)
[ "def", "tick", "(", "self", ")", ":", "self", ".", "updateGravity", "(", ")", "for", "bname", "in", "self", ".", "_buttons", ":", "if", "self", ".", "getButton", "(", "bname", ")", ":", "self", ".", "_buttons", "[", "bname", "]", "[", "\"func\"", "...
Process main-loop events: gravity, button functions, etc
[ "Process", "main", "-", "loop", "events", ":", "gravity", "button", "functions", "etc" ]
[ "# {{{0", "\"Process main-loop events: gravity, button functions, etc\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createCollision
<not_specific>
def createCollision(self, *args, **kwargs): # {{{1 """Create a collision shape. All arguments are passed to pybullet createCollisionShape.""" cargs = _merge(self._createCollisionArgs[0], args) ckwargs = _merge(self._createCollisionArgs[1], kwargs) ret = p.createCollisionShape(*cargs, **ckwargs) ...
Create a collision shape. All arguments are passed to pybullet createCollisionShape.
Create a collision shape. All arguments are passed to pybullet createCollisionShape.
[ "Create", "a", "collision", "shape", ".", "All", "arguments", "are", "passed", "to", "pybullet", "createCollisionShape", "." ]
def createCollision(self, *args, **kwargs): cargs = _merge(self._createCollisionArgs[0], args) ckwargs = _merge(self._createCollisionArgs[1], kwargs) ret = p.createCollisionShape(*cargs, **ckwargs) assertSuccess(ret, "createCollision") self._colliders.add(ret) return ret
[ "def", "createCollision", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "cargs", "=", "_merge", "(", "self", ".", "_createCollisionArgs", "[", "0", "]", ",", "args", ")", "ckwargs", "=", "_merge", "(", "self", ".", "_createCollisionArgs",...
Create a collision shape.
[ "Create", "a", "collision", "shape", "." ]
[ "# {{{1", "\"\"\"Create a collision shape. All arguments are passed to pybullet\n createCollisionShape.\"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createVisualShape
<not_specific>
def createVisualShape(self, *args, **kwargs): # {{{1 """Create a visual shape. All arguments are passed to pybullet createVisualShae. """ vargs = _merge(self._createVisualShapeArgs[0], args) vkwargs = _merge(self._createVisualShapeArgs[1], kwargs) ret = p.createVisualShape(*vargs, **vkwargs) ...
Create a visual shape. All arguments are passed to pybullet createVisualShae.
Create a visual shape. All arguments are passed to pybullet createVisualShae.
[ "Create", "a", "visual", "shape", ".", "All", "arguments", "are", "passed", "to", "pybullet", "createVisualShae", "." ]
def createVisualShape(self, *args, **kwargs): vargs = _merge(self._createVisualShapeArgs[0], args) vkwargs = _merge(self._createVisualShapeArgs[1], kwargs) ret = p.createVisualShape(*vargs, **vkwargs) assertSuccess(ret, "createVisualShape") self._visualShapes.add(ret) return ret
[ "def", "createVisualShape", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "vargs", "=", "_merge", "(", "self", ".", "_createVisualShapeArgs", "[", "0", "]", ",", "args", ")", "vkwargs", "=", "_merge", "(", "self", ".", "_createVisualShape...
Create a visual shape.
[ "Create", "a", "visual", "shape", "." ]
[ "# {{{1", "\"\"\"Create a visual shape. All arguments are passed to pybullet\n createVisualShae.\n \"\"\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createSphere
<not_specific>
def createSphere(self, mass, pos, # {{{1 radius=None, collider=None, visualShape=None, **kwargs): "Insert a new sphere into the world" if not (collider is None) ^ (radius is None): raise ValueError("Must pass either radius or coll...
Insert a new sphere into the world
Insert a new sphere into the world
[ "Insert", "a", "new", "sphere", "into", "the", "world" ]
def createSphere(self, mass, pos, radius=None, collider=None, visualShape=None, **kwargs): if not (collider is None) ^ (radius is None): raise ValueError("Must pass either radius or collider") elif collider is not None: cid...
[ "def", "createSphere", "(", "self", ",", "mass", ",", "pos", ",", "radius", "=", "None", ",", "collider", "=", "None", ",", "visualShape", "=", "None", ",", "**", "kwargs", ")", ":", "if", "not", "(", "collider", "is", "None", ")", "^", "(", "radiu...
Insert a new sphere into the world
[ "Insert", "a", "new", "sphere", "into", "the", "world" ]
[ "# {{{1", "\"Insert a new sphere into the world\"" ]
[ { "param": "self", "type": null }, { "param": "mass", "type": null }, { "param": "pos", "type": null }, { "param": "radius", "type": null }, { "param": "collider", "type": null }, { "param": "visualShape", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mass", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createBox
<not_specific>
def createBox(self, mass, pos, exts, **kwargs): # {{{1 "Insert a new box into the world" coll = self.createCollision(p.GEOM_BOX, halfExtents=exts) obj = self.createMultiBody(mass, coll, basePosition=pos, **kwargs) return obj
Insert a new box into the world
Insert a new box into the world
[ "Insert", "a", "new", "box", "into", "the", "world" ]
def createBox(self, mass, pos, exts, **kwargs): coll = self.createCollision(p.GEOM_BOX, halfExtents=exts) obj = self.createMultiBody(mass, coll, basePosition=pos, **kwargs) return obj
[ "def", "createBox", "(", "self", ",", "mass", ",", "pos", ",", "exts", ",", "**", "kwargs", ")", ":", "coll", "=", "self", ".", "createCollision", "(", "p", ".", "GEOM_BOX", ",", "halfExtents", "=", "exts", ")", "obj", "=", "self", ".", "createMultiB...
Insert a new box into the world
[ "Insert", "a", "new", "box", "into", "the", "world" ]
[ "# {{{1", "\"Insert a new box into the world\"" ]
[ { "param": "self", "type": null }, { "param": "mass", "type": null }, { "param": "pos", "type": null }, { "param": "exts", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mass", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createCapsule
<not_specific>
def createCapsule(self, mass, pos, # {{{1 radii=None, collider=None, visualShape=None, **kwargs): "Insert a new capsule into the world" if not (collider is None) ^ (radii is None): raise ValueError("Must pass either radii or c...
Insert a new capsule into the world
Insert a new capsule into the world
[ "Insert", "a", "new", "capsule", "into", "the", "world" ]
def createCapsule(self, mass, pos, radii=None, collider=None, visualShape=None, **kwargs): if not (collider is None) ^ (radii is None): raise ValueError("Must pass either radii or collider") elif collider is not None: c...
[ "def", "createCapsule", "(", "self", ",", "mass", ",", "pos", ",", "radii", "=", "None", ",", "collider", "=", "None", ",", "visualShape", "=", "None", ",", "**", "kwargs", ")", ":", "if", "not", "(", "collider", "is", "None", ")", "^", "(", "radii...
Insert a new capsule into the world
[ "Insert", "a", "new", "capsule", "into", "the", "world" ]
[ "# {{{1", "\"Insert a new capsule into the world\"" ]
[ { "param": "self", "type": null }, { "param": "mass", "type": null }, { "param": "pos", "type": null }, { "param": "radii", "type": null }, { "param": "collider", "type": null }, { "param": "visualShape", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mass", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
createCylinder
<not_specific>
def createCylinder(self, mass, pos, # {{{1 radii=None, collider=None, visualShape=None, **kwargs): "Insert a new cylinder into the world" if not (collider is None) ^ (radii is None): raise ValueError("Must pass either radi...
Insert a new cylinder into the world
Insert a new cylinder into the world
[ "Insert", "a", "new", "cylinder", "into", "the", "world" ]
def createCylinder(self, mass, pos, radii=None, collider=None, visualShape=None, **kwargs): if not (collider is None) ^ (radii is None): raise ValueError("Must pass either radii or collider") elif collider is not None: ...
[ "def", "createCylinder", "(", "self", ",", "mass", ",", "pos", ",", "radii", "=", "None", ",", "collider", "=", "None", ",", "visualShape", "=", "None", ",", "**", "kwargs", ")", ":", "if", "not", "(", "collider", "is", "None", ")", "^", "(", "radi...
Insert a new cylinder into the world
[ "Insert", "a", "new", "cylinder", "into", "the", "world" ]
[ "# {{{1", "\"Insert a new cylinder into the world\"" ]
[ { "param": "self", "type": null }, { "param": "mass", "type": null }, { "param": "pos", "type": null }, { "param": "radii", "type": null }, { "param": "collider", "type": null }, { "param": "visualShape", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "mass", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
loadURDF
<not_specific>
def loadURDF(self, path, *args, **kwargs): # {{{1 "Load object defined by the URDF file" uargs = tuple(args) ukwargs = dict(kwargs) if self._createBodyArgs[1].get("useMaximalCoordinates", False): ukwargs["useMaximalCoordinates"] = True idx = p.loadURDF(path, *uargs, **ukwargs) assertSucces...
Load object defined by the URDF file
Load object defined by the URDF file
[ "Load", "object", "defined", "by", "the", "URDF", "file" ]
def loadURDF(self, path, *args, **kwargs): uargs = tuple(args) ukwargs = dict(kwargs) if self._createBodyArgs[1].get("useMaximalCoordinates", False): ukwargs["useMaximalCoordinates"] = True idx = p.loadURDF(path, *uargs, **ukwargs) assertSuccess(idx, "loadURDF") self._bodies.add(idx) ...
[ "def", "loadURDF", "(", "self", ",", "path", ",", "*", "args", ",", "**", "kwargs", ")", ":", "uargs", "=", "tuple", "(", "args", ")", "ukwargs", "=", "dict", "(", "kwargs", ")", "if", "self", ".", "_createBodyArgs", "[", "1", "]", ".", "get", "(...
Load object defined by the URDF file
[ "Load", "object", "defined", "by", "the", "URDF", "file" ]
[ "# {{{1", "\"Load object defined by the URDF file\"" ]
[ { "param": "self", "type": null }, { "param": "path", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "path", "type": null, "docstring": null, "docstring_tokens": [...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
removeBody
null
def removeBody(self, bodyId=None, bodyIndex=None): # {{{0 "Remove a body by either ID or index" bid = None if bodyId is not None: bid = bodyId elif bodyIndex is not None: bid = p.getBodyUniqueId(bodyIndex) else: raise ValueError("Must specify a body to remove") if bid in self._...
Remove a body by either ID or index
Remove a body by either ID or index
[ "Remove", "a", "body", "by", "either", "ID", "or", "index" ]
def removeBody(self, bodyId=None, bodyIndex=None): bid = None if bodyId is not None: bid = bodyId elif bodyIndex is not None: bid = p.getBodyUniqueId(bodyIndex) else: raise ValueError("Must specify a body to remove") if bid in self._bodies: self._bodies.remove(bid) p.rem...
[ "def", "removeBody", "(", "self", ",", "bodyId", "=", "None", ",", "bodyIndex", "=", "None", ")", ":", "bid", "=", "None", "if", "bodyId", "is", "not", "None", ":", "bid", "=", "bodyId", "elif", "bodyIndex", "is", "not", "None", ":", "bid", "=", "p...
Remove a body by either ID or index
[ "Remove", "a", "body", "by", "either", "ID", "or", "index" ]
[ "# {{{0", "\"Remove a body by either ID or index\"" ]
[ { "param": "self", "type": null }, { "param": "bodyId", "type": null }, { "param": "bodyIndex", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bodyId", "type": null, "docstring": null, "docstring_tokens":...
497c7de8f556b90fa493ece443c6a27fdbdda5e2
Kaedenn/b3sim
bulletbase.py
[ "BSD-2-Clause" ]
Python
removeLastBody
null
def removeLastBody(self): # {{{0 "Remove the most recently added body. Will not remove the first body." nr = p.getNumBodies() if nr == 0: logger.warning("No body left to remove") else: bid = p.getBodyUniqueId(nr-1) if nr == 1: logger.warning("Refusing to remove last object {}"....
Remove the most recently added body. Will not remove the first body.
Remove the most recently added body. Will not remove the first body.
[ "Remove", "the", "most", "recently", "added", "body", ".", "Will", "not", "remove", "the", "first", "body", "." ]
def removeLastBody(self): nr = p.getNumBodies() if nr == 0: logger.warning("No body left to remove") else: bid = p.getBodyUniqueId(nr-1) if nr == 1: logger.warning("Refusing to remove last object {}".format(bid)) else: self.removeBody(bodyId=bid)
[ "def", "removeLastBody", "(", "self", ")", ":", "nr", "=", "p", ".", "getNumBodies", "(", ")", "if", "nr", "==", "0", ":", "logger", ".", "warning", "(", "\"No body left to remove\"", ")", "else", ":", "bid", "=", "p", ".", "getBodyUniqueId", "(", "nr"...
Remove the most recently added body.
[ "Remove", "the", "most", "recently", "added", "body", "." ]
[ "# {{{0", "\"Remove the most recently added body. Will not remove the first body.\"" ]
[ { "param": "self", "type": null } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4ec7f711c396b80277ae0fb055509ec6da7c8133
holitics/minermedic
minermedic/pools/base_pool.py
[ "Apache-2.0" ]
Python
build_creation_parameters
<not_specific>
def build_creation_parameters(self, pool, pool_attrs, pool_classname): """ Builds a set of parameters to be used by the system to create a Mining Pool Object Returns: dict """ params = {} # FOR THE OBJECT MODEL params['app_id'] = get_app_id('mi...
Builds a set of parameters to be used by the system to create a Mining Pool Object Returns: dict
Builds a set of parameters to be used by the system to create a Mining Pool Object
[ "Builds", "a", "set", "of", "parameters", "to", "be", "used", "by", "the", "system", "to", "create", "a", "Mining", "Pool", "Object" ]
def build_creation_parameters(self, pool, pool_attrs, pool_classname): params = {} params['app_id'] = get_app_id('minermedic') params['model_name'] = self.CLASSTYPE + "_" + pool_attrs['name'].upper() params['model_classtype'] = self.CLASSTYPE params['model_description'] = pool_at...
[ "def", "build_creation_parameters", "(", "self", ",", "pool", ",", "pool_attrs", ",", "pool_classname", ")", ":", "params", "=", "{", "}", "params", "[", "'app_id'", "]", "=", "get_app_id", "(", "'minermedic'", ")", "params", "[", "'model_name'", "]", "=", ...
Builds a set of parameters to be used by the system to create a Mining Pool Object
[ "Builds", "a", "set", "of", "parameters", "to", "be", "used", "by", "the", "system", "to", "create", "a", "Mining", "Pool", "Object" ]
[ "\"\"\"\n Builds a set of parameters to be used by the system to create a Mining Pool Object\n\n Returns:\n dict\n \"\"\"", "# FOR THE OBJECT MODEL", "# FOR THE OBJECT", "# name of the object that will be created", "# Set the unique ID of the pool by using the POOL URL - ...
[ { "param": "self", "type": null }, { "param": "pool", "type": null }, { "param": "pool_attrs", "type": null }, { "param": "pool_classname", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...
4ec7f711c396b80277ae0fb055509ec6da7c8133
holitics/minermedic
minermedic/pools/base_pool.py
[ "Apache-2.0" ]
Python
relate
null
def relate(self, miner): """ Creates a relationship between the Miner and the Mining Pool Returns: None """ try: from phenome_core.core.database.db import db_session # by default we will not update db updated_db = False ...
Creates a relationship between the Miner and the Mining Pool Returns: None
Creates a relationship between the Miner and the Mining Pool
[ "Creates", "a", "relationship", "between", "the", "Miner", "and", "the", "Mining", "Pool" ]
def relate(self, miner): try: from phenome_core.core.database.db import db_session updated_db = False if miner.has_relation(self._pool_object) == False: rtype_id = get_relation_type_id('MINING_ON') miner.add_relation(self._pool_object, rtype_id...
[ "def", "relate", "(", "self", ",", "miner", ")", ":", "try", ":", "from", "phenome_core", ".", "core", ".", "database", ".", "db", "import", "db_session", "updated_db", "=", "False", "if", "miner", ".", "has_relation", "(", "self", ".", "_pool_object", "...
Creates a relationship between the Miner and the Mining Pool
[ "Creates", "a", "relationship", "between", "the", "Miner", "and", "the", "Mining", "Pool" ]
[ "\"\"\"\n Creates a relationship between the Miner and the Mining Pool\n\n Returns:\n None\n \"\"\"", "# by default we will not update db", "# find out if there is a relationship from this miner to this pool", "# get the \"MINING_ON\" relationship", "# add the relation", ...
[ { "param": "self", "type": null }, { "param": "miner", "type": null } ]
{ "returns": [ { "docstring": null, "docstring_tokens": [ "None" ], "type": null } ], "raises": [], "params": [ { "identifier": "self", "type": null, "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null ...