partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
valid
niftilist_mask_to_array
From the list of absolute paths to nifti files, creates a Numpy array with the masked data. Parameters ---------- img_filelist: list of str List of absolute file paths to nifti files. All nifti files must have the same shape. mask_file: str Path to a Nifti mask file. ...
boyle/nifti/mask.py
def niftilist_mask_to_array(img_filelist, mask_file=None, outdtype=None): """From the list of absolute paths to nifti files, creates a Numpy array with the masked data. Parameters ---------- img_filelist: list of str List of absolute file paths to nifti files. All nifti files must have ...
def niftilist_mask_to_array(img_filelist, mask_file=None, outdtype=None): """From the list of absolute paths to nifti files, creates a Numpy array with the masked data. Parameters ---------- img_filelist: list of str List of absolute file paths to nifti files. All nifti files must have ...
[ "From", "the", "list", "of", "absolute", "paths", "to", "nifti", "files", "creates", "a", "Numpy", "array", "with", "the", "masked", "data", "." ]
Neurita/boyle
python
https://github.com/Neurita/boyle/blob/2dae7199849395a209c887d5f30506e1de8a9ad9/boyle/nifti/mask.py#L353-L404
[ "def", "niftilist_mask_to_array", "(", "img_filelist", ",", "mask_file", "=", "None", ",", "outdtype", "=", "None", ")", ":", "img", "=", "check_img", "(", "img_filelist", "[", "0", "]", ")", "if", "not", "outdtype", ":", "outdtype", "=", "img", ".", "dt...
2dae7199849395a209c887d5f30506e1de8a9ad9
valid
create
Create a client for Service Fabric APIs.
rcctl/rcctl/apiclient.py
def create(_): """Create a client for Service Fabric APIs.""" endpoint = client_endpoint() if not endpoint: raise CLIError("Connection endpoint not found. " "Before running sfctl commands, connect to a cluster using " "the 'sfctl cluster select' comman...
def create(_): """Create a client for Service Fabric APIs.""" endpoint = client_endpoint() if not endpoint: raise CLIError("Connection endpoint not found. " "Before running sfctl commands, connect to a cluster using " "the 'sfctl cluster select' comman...
[ "Create", "a", "client", "for", "Service", "Fabric", "APIs", "." ]
shalabhms/reliable-collections-cli
python
https://github.com/shalabhms/reliable-collections-cli/blob/195d69816fb5a6e1e9ab0ab66b606b1248b4780d/rcctl/rcctl/apiclient.py#L16-L35
[ "def", "create", "(", "_", ")", ":", "endpoint", "=", "client_endpoint", "(", ")", "if", "not", "endpoint", ":", "raise", "CLIError", "(", "\"Connection endpoint not found. \"", "\"Before running sfctl commands, connect to a cluster using \"", "\"the 'sfctl cluster select' co...
195d69816fb5a6e1e9ab0ab66b606b1248b4780d
valid
DataFrame.aggregate
Aggregate the rows of the DataFrame into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of column names of the object that function should be applie...
dataframe/dataframe.py
def aggregate(self, clazz, new_col, *args): """ Aggregate the rows of the DataFrame into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of co...
def aggregate(self, clazz, new_col, *args): """ Aggregate the rows of the DataFrame into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of co...
[ "Aggregate", "the", "rows", "of", "the", "DataFrame", "into", "a", "single", "value", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/dataframe.py#L103-L118
[ "def", "aggregate", "(", "self", ",", "clazz", ",", "new_col", ",", "*", "args", ")", ":", "if", "is_callable", "(", "clazz", ")", "and", "not", "is_none", "(", "new_col", ")", "and", "has_elements", "(", "*", "args", ")", ":", "return", "self", ".",...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
DataFrame.subset
Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns dataframe with only the columns you selected :rtype: DataFrame
dataframe/dataframe.py
def subset(self, *args): """ Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns dataframe with only the columns you selected :rtype: DataFrame """ c...
def subset(self, *args): """ Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns dataframe with only the columns you selected :rtype: DataFrame """ c...
[ "Subset", "only", "some", "of", "the", "columns", "of", "the", "DataFrame", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/dataframe.py#L132-L146
[ "def", "subset", "(", "self", ",", "*", "args", ")", ":", "cols", "=", "{", "}", "for", "k", "in", "self", ".", "colnames", ":", "if", "k", "in", "args", ":", "cols", "[", "str", "(", "k", ")", "]", "=", "self", ".", "__data_columns", "[", "s...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
DataFrame.modify
Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of column names of the object that ...
dataframe/dataframe.py
def modify(self, clazz, new_col, *args): """ Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str ...
def modify(self, clazz, new_col, *args): """ Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str ...
[ "Modify", "some", "columns", "(", "i", ".", "e", ".", "apply", "a", "function", ")", "and", "add", "the", "result", "to", "the", "table", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/dataframe.py#L159-L176
[ "def", "modify", "(", "self", ",", "clazz", ",", "new_col", ",", "*", "args", ")", ":", "if", "is_callable", "(", "clazz", ")", "and", "not", "is_none", "(", "new_col", ")", "and", "has_elements", "(", "*", "args", ")", ":", "return", "self", ".", ...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
group
Pipeable grouping method. Takes either - a dataframe and a tuple of strings for grouping, - a tuple of strings if a dataframe has already been piped into. :Example: group(dataframe, "column") :Example: dataframe >> group("column") :param args: tuple of a...
dataframe/pipeable_functions.py
def group(*args): """ Pipeable grouping method. Takes either - a dataframe and a tuple of strings for grouping, - a tuple of strings if a dataframe has already been piped into. :Example: group(dataframe, "column") :Example: dataframe >> group("column") ...
def group(*args): """ Pipeable grouping method. Takes either - a dataframe and a tuple of strings for grouping, - a tuple of strings if a dataframe has already been piped into. :Example: group(dataframe, "column") :Example: dataframe >> group("column") ...
[ "Pipeable", "grouping", "method", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/pipeable_functions.py#L29-L56
[ "def", "group", "(", "*", "args", ")", ":", "if", "args", "and", "isinstance", "(", "args", "[", "0", "]", ",", "dataframe", ".", "DataFrame", ")", ":", "return", "args", "[", "0", "]", ".", "group", "(", "*", "args", "[", "1", ":", "]", ")", ...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
aggregate
Pipeable aggregation method. Takes either - a dataframe and a tuple of arguments required for aggregation, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: aggregate(dataframe, Function, "new_...
dataframe/pipeable_functions.py
def aggregate(*args): """ Pipeable aggregation method. Takes either - a dataframe and a tuple of arguments required for aggregation, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: ag...
def aggregate(*args): """ Pipeable aggregation method. Takes either - a dataframe and a tuple of arguments required for aggregation, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: ag...
[ "Pipeable", "aggregation", "method", ".", "Takes", "either", "-", "a", "dataframe", "and", "a", "tuple", "of", "arguments", "required", "for", "aggregation", "-", "a", "tuple", "of", "arguments", "if", "a", "dataframe", "has", "already", "been", "piped", "in...
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/pipeable_functions.py#L59-L87
[ "def", "aggregate", "(", "*", "args", ")", ":", "if", "args", "and", "isinstance", "(", "args", "[", "0", "]", ",", "dataframe", ".", "DataFrame", ")", ":", "return", "args", "[", "0", "]", ".", "aggregate", "(", "args", "[", "1", "]", ",", "args...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
subset
Pipeable subsetting method. Takes either - a dataframe and a tuple of arguments required for subsetting, - a tuple of arguments if a dataframe has already been piped into. :Example: subset(dataframe, "column") :Example: dataframe >> subset("column") :param args: t...
dataframe/pipeable_functions.py
def subset(*args): """ Pipeable subsetting method. Takes either - a dataframe and a tuple of arguments required for subsetting, - a tuple of arguments if a dataframe has already been piped into. :Example: subset(dataframe, "column") :Example: dataframe >> subse...
def subset(*args): """ Pipeable subsetting method. Takes either - a dataframe and a tuple of arguments required for subsetting, - a tuple of arguments if a dataframe has already been piped into. :Example: subset(dataframe, "column") :Example: dataframe >> subse...
[ "Pipeable", "subsetting", "method", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/pipeable_functions.py#L90-L117
[ "def", "subset", "(", "*", "args", ")", ":", "if", "args", "and", "isinstance", "(", "args", "[", "0", "]", ",", "dataframe", ".", "DataFrame", ")", ":", "return", "args", "[", "0", "]", ".", "subset", "(", "*", "args", "[", "1", ":", "]", ")",...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
modify
Pipeable modification method Takes either - a dataframe and a tuple of arguments required for modification, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: modify(dataframe, Function, "new_c...
dataframe/pipeable_functions.py
def modify(*args): """ Pipeable modification method Takes either - a dataframe and a tuple of arguments required for modification, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: mod...
def modify(*args): """ Pipeable modification method Takes either - a dataframe and a tuple of arguments required for modification, - a tuple of arguments if a dataframe has already been piped into. In any case one argument has to be a class that extends callable. :Example: mod...
[ "Pipeable", "modification", "method", "Takes", "either", "-", "a", "dataframe", "and", "a", "tuple", "of", "arguments", "required", "for", "modification", "-", "a", "tuple", "of", "arguments", "if", "a", "dataframe", "has", "already", "been", "piped", "into", ...
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/pipeable_functions.py#L120-L148
[ "def", "modify", "(", "*", "args", ")", ":", "if", "args", "and", "isinstance", "(", "args", "[", "0", "]", ",", "dataframe", ".", "DataFrame", ")", ":", "return", "args", "[", "0", "]", ".", "modify", "(", "args", "[", "1", "]", ",", "args", "...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
_escape_char
Escape a single character
escapism.py
def _escape_char(c, escape_char=ESCAPE_CHAR): """Escape a single character""" buf = [] for byte in c.encode('utf8'): buf.append(escape_char) buf.append('%X' % _ord(byte)) return ''.join(buf)
def _escape_char(c, escape_char=ESCAPE_CHAR): """Escape a single character""" buf = [] for byte in c.encode('utf8'): buf.append(escape_char) buf.append('%X' % _ord(byte)) return ''.join(buf)
[ "Escape", "a", "single", "character" ]
minrk/escapism
python
https://github.com/minrk/escapism/blob/35f4c194ad6de2bc3339bb8b0e522dca989143ff/escapism.py#L30-L36
[ "def", "_escape_char", "(", "c", ",", "escape_char", "=", "ESCAPE_CHAR", ")", ":", "buf", "=", "[", "]", "for", "byte", "in", "c", ".", "encode", "(", "'utf8'", ")", ":", "buf", ".", "append", "(", "escape_char", ")", "buf", ".", "append", "(", "'%...
35f4c194ad6de2bc3339bb8b0e522dca989143ff
valid
escape
Escape a string so that it only contains characters in a safe set. Characters outside the safe list will be escaped with _%x_, where %x is the hex value of the character. If `allow_collisions` is True, occurrences of `escape_char` in the input will not be escaped. In this case, `unescape` cannot ...
escapism.py
def escape(to_escape, safe=SAFE, escape_char=ESCAPE_CHAR, allow_collisions=False): """Escape a string so that it only contains characters in a safe set. Characters outside the safe list will be escaped with _%x_, where %x is the hex value of the character. If `allow_collisions` is True, occurrences of...
def escape(to_escape, safe=SAFE, escape_char=ESCAPE_CHAR, allow_collisions=False): """Escape a string so that it only contains characters in a safe set. Characters outside the safe list will be escaped with _%x_, where %x is the hex value of the character. If `allow_collisions` is True, occurrences of...
[ "Escape", "a", "string", "so", "that", "it", "only", "contains", "characters", "in", "a", "safe", "set", "." ]
minrk/escapism
python
https://github.com/minrk/escapism/blob/35f4c194ad6de2bc3339bb8b0e522dca989143ff/escapism.py#L39-L79
[ "def", "escape", "(", "to_escape", ",", "safe", "=", "SAFE", ",", "escape_char", "=", "ESCAPE_CHAR", ",", "allow_collisions", "=", "False", ")", ":", "if", "isinstance", "(", "to_escape", ",", "bytes", ")", ":", "# always work on text", "to_escape", "=", "to...
35f4c194ad6de2bc3339bb8b0e522dca989143ff
valid
unescape
Unescape a string escaped with `escape` escape_char must be the same as that used in the call to escape.
escapism.py
def unescape(escaped, escape_char=ESCAPE_CHAR): """Unescape a string escaped with `escape` escape_char must be the same as that used in the call to escape. """ if isinstance(escaped, bytes): # always work on text escaped = escaped.decode('utf8') escape_pat = re.compile(re.e...
def unescape(escaped, escape_char=ESCAPE_CHAR): """Unescape a string escaped with `escape` escape_char must be the same as that used in the call to escape. """ if isinstance(escaped, bytes): # always work on text escaped = escaped.decode('utf8') escape_pat = re.compile(re.e...
[ "Unescape", "a", "string", "escaped", "with", "escape", "escape_char", "must", "be", "the", "same", "as", "that", "used", "in", "the", "call", "to", "escape", "." ]
minrk/escapism
python
https://github.com/minrk/escapism/blob/35f4c194ad6de2bc3339bb8b0e522dca989143ff/escapism.py#L91-L102
[ "def", "unescape", "(", "escaped", ",", "escape_char", "=", "ESCAPE_CHAR", ")", ":", "if", "isinstance", "(", "escaped", ",", "bytes", ")", ":", "# always work on text", "escaped", "=", "escaped", ".", "decode", "(", "'utf8'", ")", "escape_pat", "=", "re", ...
35f4c194ad6de2bc3339bb8b0e522dca989143ff
valid
BaseBackend.can_send
Determines whether this backend is allowed to send a notification to the given user and notice_type.
notification/backends/base.py
def can_send(self, user, notice_type): """ Determines whether this backend is allowed to send a notification to the given user and notice_type. """ from notification.models import NoticeSetting return NoticeSetting.for_user(user, notice_type, self.medium_id).send
def can_send(self, user, notice_type): """ Determines whether this backend is allowed to send a notification to the given user and notice_type. """ from notification.models import NoticeSetting return NoticeSetting.for_user(user, notice_type, self.medium_id).send
[ "Determines", "whether", "this", "backend", "is", "allowed", "to", "send", "a", "notification", "to", "the", "given", "user", "and", "notice_type", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/backends/base.py#L17-L23
[ "def", "can_send", "(", "self", ",", "user", ",", "notice_type", ")", ":", "from", "notification", ".", "models", "import", "NoticeSetting", "return", "NoticeSetting", ".", "for_user", "(", "user", ",", "notice_type", ",", "self", ".", "medium_id", ")", ".",...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
BaseBackend.get_formatted_messages
Returns a dictionary with the format identifier as the key. The values are are fully rendered templates with the given context.
notification/backends/base.py
def get_formatted_messages(self, formats, label, context): """ Returns a dictionary with the format identifier as the key. The values are are fully rendered templates with the given context. """ format_templates = {} for fmt in formats: # conditionally turn of...
def get_formatted_messages(self, formats, label, context): """ Returns a dictionary with the format identifier as the key. The values are are fully rendered templates with the given context. """ format_templates = {} for fmt in formats: # conditionally turn of...
[ "Returns", "a", "dictionary", "with", "the", "format", "identifier", "as", "the", "key", ".", "The", "values", "are", "are", "fully", "rendered", "templates", "with", "the", "given", "context", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/backends/base.py#L31-L44
[ "def", "get_formatted_messages", "(", "self", ",", "formats", ",", "label", ",", "context", ")", ":", "format_templates", "=", "{", "}", "for", "fmt", "in", "formats", ":", "# conditionally turn off autoescaping for .txt extensions in format", "if", "fmt", ".", "end...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
copy_attributes
Copy the attributes from a source object to a destination object.
generator/util.py
def copy_attributes(source, destination, ignore_patterns=[]): """ Copy the attributes from a source object to a destination object. """ for attr in _wildcard_filter(dir(source), *ignore_patterns): setattr(destination, attr, getattr(source, attr))
def copy_attributes(source, destination, ignore_patterns=[]): """ Copy the attributes from a source object to a destination object. """ for attr in _wildcard_filter(dir(source), *ignore_patterns): setattr(destination, attr, getattr(source, attr))
[ "Copy", "the", "attributes", "from", "a", "source", "object", "to", "a", "destination", "object", "." ]
kevinastone/generator
python
https://github.com/kevinastone/generator/blob/d7a6484582f3b69d4bc645bf3f20bb03924d5b39/generator/util.py#L11-L16
[ "def", "copy_attributes", "(", "source", ",", "destination", ",", "ignore_patterns", "=", "[", "]", ")", ":", "for", "attr", "in", "_wildcard_filter", "(", "dir", "(", "source", ")", ",", "*", "ignore_patterns", ")", ":", "setattr", "(", "destination", ","...
d7a6484582f3b69d4bc645bf3f20bb03924d5b39
valid
DataFrameColumnSet.row
Returns DataFrameRow of the DataFrame given its index. :param idx: the index of the row in the DataFrame. :return: returns a DataFrameRow
dataframe/_dataframe_column_set.py
def row(self, idx): """ Returns DataFrameRow of the DataFrame given its index. :param idx: the index of the row in the DataFrame. :return: returns a DataFrameRow """ return DataFrameRow(idx, [x[idx] for x in self], self.colnames)
def row(self, idx): """ Returns DataFrameRow of the DataFrame given its index. :param idx: the index of the row in the DataFrame. :return: returns a DataFrameRow """ return DataFrameRow(idx, [x[idx] for x in self], self.colnames)
[ "Returns", "DataFrameRow", "of", "the", "DataFrame", "given", "its", "index", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/_dataframe_column_set.py#L72-L79
[ "def", "row", "(", "self", ",", "idx", ")", ":", "return", "DataFrameRow", "(", "idx", ",", "[", "x", "[", "idx", "]", "for", "x", "in", "self", "]", ",", "self", ".", "colnames", ")" ]
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
notice_settings
The notice settings view. Template: :template:`notification/notice_settings.html` Context: notice_types A list of all :model:`notification.NoticeType` objects. notice_settings A dictionary containing ``column_headers`` for each ``NOTICE_MEDIA`` and ``rows`...
notification/views.py
def notice_settings(request): """ The notice settings view. Template: :template:`notification/notice_settings.html` Context: notice_types A list of all :model:`notification.NoticeType` objects. notice_settings A dictionary containing ``column_headers`` for eac...
def notice_settings(request): """ The notice settings view. Template: :template:`notification/notice_settings.html` Context: notice_types A list of all :model:`notification.NoticeType` objects. notice_settings A dictionary containing ``column_headers`` for eac...
[ "The", "notice", "settings", "view", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/views.py#L11-L61
[ "def", "notice_settings", "(", "request", ")", ":", "notice_types", "=", "NoticeType", ".", "objects", ".", "all", "(", ")", "settings_table", "=", "[", "]", "for", "notice_type", "in", "notice_types", ":", "settings_row", "=", "[", "]", "for", "medium_id", ...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
Tungsten.query
Query Wolfram Alpha and return a Result object
tungsten/core.py
def query(self, input = '', params = {}): """Query Wolfram Alpha and return a Result object""" # Get and construct query parameters # Default parameters payload = {'input': input, 'appid': self.appid} # Additional parameters (from params), formatted for url ...
def query(self, input = '', params = {}): """Query Wolfram Alpha and return a Result object""" # Get and construct query parameters # Default parameters payload = {'input': input, 'appid': self.appid} # Additional parameters (from params), formatted for url ...
[ "Query", "Wolfram", "Alpha", "and", "return", "a", "Result", "object" ]
seenaburns/Tungsten
python
https://github.com/seenaburns/Tungsten/blob/9e865c77a11c512464f226a6b025bc43b798a8be/tungsten/core.py#L18-L45
[ "def", "query", "(", "self", ",", "input", "=", "''", ",", "params", "=", "{", "}", ")", ":", "# Get and construct query parameters", "# Default parameters", "payload", "=", "{", "'input'", ":", "input", ",", "'appid'", ":", "self", ".", "appid", "}", "# A...
9e865c77a11c512464f226a6b025bc43b798a8be
valid
Result.pods
Return list of all Pod objects in result
tungsten/core.py
def pods(self): """Return list of all Pod objects in result""" # Return empty list if xml_tree is not defined (error Result object) if not self.xml_tree: return [] # Create a Pod object for every pod group in xml return [Pod(elem) for elem in self.xml_tree.findall('p...
def pods(self): """Return list of all Pod objects in result""" # Return empty list if xml_tree is not defined (error Result object) if not self.xml_tree: return [] # Create a Pod object for every pod group in xml return [Pod(elem) for elem in self.xml_tree.findall('p...
[ "Return", "list", "of", "all", "Pod", "objects", "in", "result" ]
seenaburns/Tungsten
python
https://github.com/seenaburns/Tungsten/blob/9e865c77a11c512464f226a6b025bc43b798a8be/tungsten/core.py#L80-L87
[ "def", "pods", "(", "self", ")", ":", "# Return empty list if xml_tree is not defined (error Result object)", "if", "not", "self", ".", "xml_tree", ":", "return", "[", "]", "# Create a Pod object for every pod group in xml", "return", "[", "Pod", "(", "elem", ")", "for"...
9e865c77a11c512464f226a6b025bc43b798a8be
valid
Pod.format
Dictionary of available formats, corresponding to a list of the values Example: pod.format['plaintext'] will return a list of every plaintext content in the pod's subpods
tungsten/core.py
def format(self): """ Dictionary of available formats, corresponding to a list of the values Example: pod.format['plaintext'] will return a list of every plaintext content in the pod's subpods """ formats = {} # Iterate through all the tags (formats) in ...
def format(self): """ Dictionary of available formats, corresponding to a list of the values Example: pod.format['plaintext'] will return a list of every plaintext content in the pod's subpods """ formats = {} # Iterate through all the tags (formats) in ...
[ "Dictionary", "of", "available", "formats", "corresponding", "to", "a", "list", "of", "the", "values", "Example", ":", "pod", ".", "format", "[", "plaintext", "]", "will", "return", "a", "list", "of", "every", "plaintext", "content", "in", "the", "pod", "s...
seenaburns/Tungsten
python
https://github.com/seenaburns/Tungsten/blob/9e865c77a11c512464f226a6b025bc43b798a8be/tungsten/core.py#L108-L144
[ "def", "format", "(", "self", ")", ":", "formats", "=", "{", "}", "# Iterate through all the tags (formats) in subpods", "# 'state' is a tag but not an acceptable format", "for", "subpod", "in", "self", ".", "root", ".", "findall", "(", "'subpod'", ")", ":", "# elem w...
9e865c77a11c512464f226a6b025bc43b798a8be
valid
SearchTree.find
Find a node in the tree. If the node is not found it is added first and then returned. :param args: a tuple :return: returns the node
dataframe/search_tree/search_tree.py
def find(self, *args): """ Find a node in the tree. If the node is not found it is added first and then returned. :param args: a tuple :return: returns the node """ curr_node = self.__root return self.__traverse(curr_node, 0, *args)
def find(self, *args): """ Find a node in the tree. If the node is not found it is added first and then returned. :param args: a tuple :return: returns the node """ curr_node = self.__root return self.__traverse(curr_node, 0, *args)
[ "Find", "a", "node", "in", "the", "tree", ".", "If", "the", "node", "is", "not", "found", "it", "is", "added", "first", "and", "then", "returned", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/search_tree/search_tree.py#L37-L45
[ "def", "find", "(", "self", ",", "*", "args", ")", ":", "curr_node", "=", "self", ".", "__root", "return", "self", ".", "__traverse", "(", "curr_node", ",", "0", ",", "*", "args", ")" ]
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
get_notification_language
Returns site-specific notification language for this user. Raises LanguageStoreNotAvailable if this site does not use translated notifications.
notification/models.py
def get_notification_language(user): """ Returns site-specific notification language for this user. Raises LanguageStoreNotAvailable if this site does not use translated notifications. """ if getattr(settings, "NOTIFICATION_LANGUAGE_MODULE", False): try: app_label, model_name...
def get_notification_language(user): """ Returns site-specific notification language for this user. Raises LanguageStoreNotAvailable if this site does not use translated notifications. """ if getattr(settings, "NOTIFICATION_LANGUAGE_MODULE", False): try: app_label, model_name...
[ "Returns", "site", "-", "specific", "notification", "language", "for", "this", "user", ".", "Raises", "LanguageStoreNotAvailable", "if", "this", "site", "does", "not", "use", "translated", "notifications", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L117-L133
[ "def", "get_notification_language", "(", "user", ")", ":", "if", "getattr", "(", "settings", ",", "\"NOTIFICATION_LANGUAGE_MODULE\"", ",", "False", ")", ":", "try", ":", "app_label", ",", "model_name", "=", "settings", ".", "NOTIFICATION_LANGUAGE_MODULE", ".", "sp...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
send_now
Creates a new notice. This is intended to be how other apps create new notices. notification.send(user, "friends_invite_sent", { "spam": "eggs", "foo": "bar", )
notification/models.py
def send_now(users, label, extra_context=None, sender=None): """ Creates a new notice. This is intended to be how other apps create new notices. notification.send(user, "friends_invite_sent", { "spam": "eggs", "foo": "bar", ) """ sent = False if extra_context is None: ...
def send_now(users, label, extra_context=None, sender=None): """ Creates a new notice. This is intended to be how other apps create new notices. notification.send(user, "friends_invite_sent", { "spam": "eggs", "foo": "bar", ) """ sent = False if extra_context is None: ...
[ "Creates", "a", "new", "notice", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L136-L174
[ "def", "send_now", "(", "users", ",", "label", ",", "extra_context", "=", "None", ",", "sender", "=", "None", ")", ":", "sent", "=", "False", "if", "extra_context", "is", "None", ":", "extra_context", "=", "{", "}", "notice_type", "=", "NoticeType", ".",...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
send
A basic interface around both queue and send_now. This honors a global flag NOTIFICATION_QUEUE_ALL that helps determine whether all calls should be queued or not. A per call ``queue`` or ``now`` keyword argument can be used to always override the default global behavior.
notification/models.py
def send(*args, **kwargs): """ A basic interface around both queue and send_now. This honors a global flag NOTIFICATION_QUEUE_ALL that helps determine whether all calls should be queued or not. A per call ``queue`` or ``now`` keyword argument can be used to always override the default global behavio...
def send(*args, **kwargs): """ A basic interface around both queue and send_now. This honors a global flag NOTIFICATION_QUEUE_ALL that helps determine whether all calls should be queued or not. A per call ``queue`` or ``now`` keyword argument can be used to always override the default global behavio...
[ "A", "basic", "interface", "around", "both", "queue", "and", "send_now", ".", "This", "honors", "a", "global", "flag", "NOTIFICATION_QUEUE_ALL", "that", "helps", "determine", "whether", "all", "calls", "should", "be", "queued", "or", "not", ".", "A", "per", ...
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L177-L195
[ "def", "send", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "queue_flag", "=", "kwargs", ".", "pop", "(", "\"queue\"", ",", "False", ")", "now_flag", "=", "kwargs", ".", "pop", "(", "\"now\"", ",", "False", ")", "assert", "not", "(", "queue...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
queue
Queue the notification in NoticeQueueBatch. This allows for large amounts of user notifications to be deferred to a seperate process running outside the webserver.
notification/models.py
def queue(users, label, extra_context=None, sender=None): """ Queue the notification in NoticeQueueBatch. This allows for large amounts of user notifications to be deferred to a seperate process running outside the webserver. """ if extra_context is None: extra_context = {} if isinst...
def queue(users, label, extra_context=None, sender=None): """ Queue the notification in NoticeQueueBatch. This allows for large amounts of user notifications to be deferred to a seperate process running outside the webserver. """ if extra_context is None: extra_context = {} if isinst...
[ "Queue", "the", "notification", "in", "NoticeQueueBatch", ".", "This", "allows", "for", "large", "amounts", "of", "user", "notifications", "to", "be", "deferred", "to", "a", "seperate", "process", "running", "outside", "the", "webserver", "." ]
GeoNode/geonode-notification
python
https://github.com/GeoNode/geonode-notification/blob/c60bc28f16f5d0e62536e76c17d6944a79449ef1/notification/models.py#L198-L213
[ "def", "queue", "(", "users", ",", "label", ",", "extra_context", "=", "None", ",", "sender", "=", "None", ")", ":", "if", "extra_context", "is", "None", ":", "extra_context", "=", "{", "}", "if", "isinstance", "(", "users", ",", "QuerySet", ")", ":", ...
c60bc28f16f5d0e62536e76c17d6944a79449ef1
valid
write_table_pair_potential
A helper function to write lammps pair potentials to string. Assumes that functions are vectorized. Parameters ---------- func: function A function that will be evaluated for the force at each radius. Required to be numpy vectorizable. dfunc: function Optional. A function that ...
lammps/potential.py
def write_table_pair_potential(func, dfunc=None, bounds=(1.0, 10.0), samples=1000, tollerance=1e-6, keyword='PAIR'): """A helper function to write lammps pair potentials to string. Assumes that functions are vectorized. Parameters ---------- func: function A function that will be evaluated f...
def write_table_pair_potential(func, dfunc=None, bounds=(1.0, 10.0), samples=1000, tollerance=1e-6, keyword='PAIR'): """A helper function to write lammps pair potentials to string. Assumes that functions are vectorized. Parameters ---------- func: function A function that will be evaluated f...
[ "A", "helper", "function", "to", "write", "lammps", "pair", "potentials", "to", "string", ".", "Assumes", "that", "functions", "are", "vectorized", "." ]
costrouc/lammps-cython
python
https://github.com/costrouc/lammps-cython/blob/90f05d8b95fdf02005af8856f20f1c093c479ca3/lammps/potential.py#L4-L43
[ "def", "write_table_pair_potential", "(", "func", ",", "dfunc", "=", "None", ",", "bounds", "=", "(", "1.0", ",", "10.0", ")", ",", "samples", "=", "1000", ",", "tollerance", "=", "1e-6", ",", "keyword", "=", "'PAIR'", ")", ":", "r_min", ",", "r_max", ...
90f05d8b95fdf02005af8856f20f1c093c479ca3
valid
write_tersoff_potential
Write tersoff potential file from parameters to string Parameters ---------- parameters: dict keys are tuple of elements with the values being the parameters length 14
lammps/potential.py
def write_tersoff_potential(parameters): """Write tersoff potential file from parameters to string Parameters ---------- parameters: dict keys are tuple of elements with the values being the parameters length 14 """ lines = [] for (e1, e2, e3), params in parameters.items(): i...
def write_tersoff_potential(parameters): """Write tersoff potential file from parameters to string Parameters ---------- parameters: dict keys are tuple of elements with the values being the parameters length 14 """ lines = [] for (e1, e2, e3), params in parameters.items(): i...
[ "Write", "tersoff", "potential", "file", "from", "parameters", "to", "string" ]
costrouc/lammps-cython
python
https://github.com/costrouc/lammps-cython/blob/90f05d8b95fdf02005af8856f20f1c093c479ca3/lammps/potential.py#L46-L59
[ "def", "write_tersoff_potential", "(", "parameters", ")", ":", "lines", "=", "[", "]", "for", "(", "e1", ",", "e2", ",", "e3", ")", ",", "params", "in", "parameters", ".", "items", "(", ")", ":", "if", "len", "(", "params", ")", "!=", "14", ":", ...
90f05d8b95fdf02005af8856f20f1c093c479ca3
valid
GroupedDataFrame.subset
Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns DataFrame with only the columns you selected :rtype: DataFrame
dataframe/grouped_dataframe.py
def subset(self, *args): """ Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns DataFrame with only the columns you selected :rtype: DataFrame """ a...
def subset(self, *args): """ Subset only some of the columns of the DataFrame. :param args: list of column names of the object that should be subsetted :type args: tuple :return: returns DataFrame with only the columns you selected :rtype: DataFrame """ a...
[ "Subset", "only", "some", "of", "the", "columns", "of", "the", "DataFrame", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/grouped_dataframe.py#L92-L105
[ "def", "subset", "(", "self", ",", "*", "args", ")", ":", "args", "=", "list", "(", "args", ")", "args", ".", "extend", "(", "[", "x", "for", "x", "in", "self", ".", "__grouping", ".", "grouping_colnames", "if", "x", "not", "in", "args", "]", ")"...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
GroupedDataFrame.modify
Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of column names of the object that ...
dataframe/grouped_dataframe.py
def modify(self, clazz, new_col, *args): """ Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str ...
def modify(self, clazz, new_col, *args): """ Modify some columns (i.e. apply a function) and add the result to the table. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str ...
[ "Modify", "some", "columns", "(", "i", ".", "e", ".", "apply", "a", "function", ")", "and", "add", "the", "result", "to", "the", "table", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/grouped_dataframe.py#L121-L143
[ "def", "modify", "(", "self", ",", "clazz", ",", "new_col", ",", "*", "args", ")", ":", "if", "is_callable", "(", "clazz", ")", "and", "not", "is_none", "(", "new_col", ")", "and", "has_elements", "(", "*", "args", ")", "and", "is_disjoint", "(", "se...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
GroupedDataFrame.aggregate
Aggregate the rows of each group into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of column names of the object that function should be applied t...
dataframe/grouped_dataframe.py
def aggregate(self, clazz, new_col, *args): """ Aggregate the rows of each group into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of colum...
def aggregate(self, clazz, new_col, *args): """ Aggregate the rows of each group into a single value. :param clazz: name of a class that extends class Callable :type clazz: class :param new_col: name of the new column :type new_col: str :param args: list of colum...
[ "Aggregate", "the", "rows", "of", "each", "group", "into", "a", "single", "value", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/grouped_dataframe.py#L159-L179
[ "def", "aggregate", "(", "self", ",", "clazz", ",", "new_col", ",", "*", "args", ")", ":", "if", "is_callable", "(", "clazz", ")", "and", "not", "is_none", "(", "new_col", ")", "and", "has_elements", "(", "*", "args", ")", "and", "is_disjoint", "(", ...
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
reader
Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. (optional) :return: generator of record in [[label, value], ...] form.
ltsv/_reader.py
def reader(ltsvfile, labels=None): """Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. (optional) :return: generator of record in [[label, value], ...] form. """ label_pattern = re.compile(r"^[0-9A-Za-z_.-]+:") if labels...
def reader(ltsvfile, labels=None): """Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. (optional) :return: generator of record in [[label, value], ...] form. """ label_pattern = re.compile(r"^[0-9A-Za-z_.-]+:") if labels...
[ "Make", "LTSV", "Reader", "for", "reading", "selected", "labels", "." ]
hekyou/python-ltsv
python
https://github.com/hekyou/python-ltsv/blob/fd5e9c82c28da666d1dbdb3318f6e90d86143ff8/ltsv/_reader.py#L5-L26
[ "def", "reader", "(", "ltsvfile", ",", "labels", "=", "None", ")", ":", "label_pattern", "=", "re", ".", "compile", "(", "r\"^[0-9A-Za-z_.-]+:\"", ")", "if", "labels", "is", "not", "None", ":", "prefixes", "=", "tuple", "(", "L", "+", "':'", "for", "L"...
fd5e9c82c28da666d1dbdb3318f6e90d86143ff8
valid
DictReader
Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. :return: generator of record in {label: value, ...} form.
ltsv/_reader.py
def DictReader(ltsvfile, labels=None, dict_type=dict): """Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. :return: generator of record in {label: value, ...} form. """ for rec in reader(ltsvfile, labels): yield dict_...
def DictReader(ltsvfile, labels=None, dict_type=dict): """Make LTSV Reader for reading selected labels. :param ltsvfile: iterable of lines. :param labels: sequence of labels. :return: generator of record in {label: value, ...} form. """ for rec in reader(ltsvfile, labels): yield dict_...
[ "Make", "LTSV", "Reader", "for", "reading", "selected", "labels", "." ]
hekyou/python-ltsv
python
https://github.com/hekyou/python-ltsv/blob/fd5e9c82c28da666d1dbdb3318f6e90d86143ff8/ltsv/_reader.py#L28-L36
[ "def", "DictReader", "(", "ltsvfile", ",", "labels", "=", "None", ",", "dict_type", "=", "dict", ")", ":", "for", "rec", "in", "reader", "(", "ltsvfile", ",", "labels", ")", ":", "yield", "dict_type", "(", "rec", ")" ]
fd5e9c82c28da666d1dbdb3318f6e90d86143ff8
valid
is_disjoint
Checks if elements of set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are NOT disjoint :return: returns true no elements of set2 are in set1
dataframe/_check.py
def is_disjoint(set1, set2, warn): """ Checks if elements of set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are NOT disjoint :return: returns true no elements of set2 are in set1 """ for...
def is_disjoint(set1, set2, warn): """ Checks if elements of set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are NOT disjoint :return: returns true no elements of set2 are in set1 """ for...
[ "Checks", "if", "elements", "of", "set2", "are", "in", "set1", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/_check.py#L64-L77
[ "def", "is_disjoint", "(", "set1", ",", "set2", ",", "warn", ")", ":", "for", "elem", "in", "set2", ":", "if", "elem", "in", "set1", ":", "raise", "ValueError", "(", "warn", ")", "return", "True" ]
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
contains_all
Checks if all elements from set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are not containd :return: returns true if all values of set2 are in set1
dataframe/_check.py
def contains_all(set1, set2, warn): """ Checks if all elements from set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are not containd :return: returns true if all values of set2 are in set1 ...
def contains_all(set1, set2, warn): """ Checks if all elements from set2 are in set1. :param set1: a set of values :param set2: a set of values :param warn: the error message that should be thrown when the sets are not containd :return: returns true if all values of set2 are in set1 ...
[ "Checks", "if", "all", "elements", "from", "set2", "are", "in", "set1", "." ]
dirmeier/dataframe
python
https://github.com/dirmeier/dataframe/blob/39992e23293393cc1320d1b9c1c8d2c325fc5626/dataframe/_check.py#L80-L93
[ "def", "contains_all", "(", "set1", ",", "set2", ",", "warn", ")", ":", "for", "elem", "in", "set2", ":", "if", "elem", "not", "in", "set1", ":", "raise", "ValueError", "(", "warn", ")", "return", "True" ]
39992e23293393cc1320d1b9c1c8d2c325fc5626
valid
MARCXMLSerializer.to_XML
Serialize object back to XML string. Returns: str: String which should be same as original input, if everything\ works as expected.
src/marcxml_parser/serializer.py
def to_XML(self): """ Serialize object back to XML string. Returns: str: String which should be same as original input, if everything\ works as expected. """ marcxml_template = """<record xmlns="http://www.loc.gov/MARC21/slim/" xmlns:xsi="http://www....
def to_XML(self): """ Serialize object back to XML string. Returns: str: String which should be same as original input, if everything\ works as expected. """ marcxml_template = """<record xmlns="http://www.loc.gov/MARC21/slim/" xmlns:xsi="http://www....
[ "Serialize", "object", "back", "to", "XML", "string", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/serializer.py#L105-L150
[ "def", "to_XML", "(", "self", ")", ":", "marcxml_template", "=", "\"\"\"<record xmlns=\"http://www.loc.gov/MARC21/slim/\"\nxmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\nxsi:schemaLocation=\"http://www.loc.gov/MARC21/slim\nhttp://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd\">\n$LEA...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser._parse_string
Parse MARC XML document to dicts, which are contained in self.controlfields and self.datafields. Args: xml (str or HTMLElement): input data Also detect if this is oai marc format or not (see elf.oai_marc).
src/marcxml_parser/parser.py
def _parse_string(self, xml): """ Parse MARC XML document to dicts, which are contained in self.controlfields and self.datafields. Args: xml (str or HTMLElement): input data Also detect if this is oai marc format or not (see elf.oai_marc). """ if not...
def _parse_string(self, xml): """ Parse MARC XML document to dicts, which are contained in self.controlfields and self.datafields. Args: xml (str or HTMLElement): input data Also detect if this is oai marc format or not (see elf.oai_marc). """ if not...
[ "Parse", "MARC", "XML", "document", "to", "dicts", "which", "are", "contained", "in", "self", ".", "controlfields", "and", "self", ".", "datafields", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L89-L126
[ "def", "_parse_string", "(", "self", ",", "xml", ")", ":", "if", "not", "isinstance", "(", "xml", ",", "HTMLElement", ")", ":", "xml", "=", "dhtmlparser", ".", "parseString", "(", "str", "(", "xml", ")", ")", "# check if there are any records", "record", "...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser._parse_control_fields
Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of oai_marc "id".
src/marcxml_parser/parser.py
def _parse_control_fields(self, fields, tag_id="tag"): """ Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
def _parse_control_fields(self, fields, tag_id="tag"): """ Parse control fields. Args: fields (list): list of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
[ "Parse", "control", "fields", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L128-L145
[ "def", "_parse_control_fields", "(", "self", ",", "fields", ",", "tag_id", "=", "\"tag\"", ")", ":", "for", "field", "in", "fields", ":", "params", "=", "field", ".", "params", "# skip tags without parameters", "if", "tag_id", "not", "in", "params", ":", "co...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser._parse_data_fields
Parse data fields. Args: fields (list): of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of oai_marc "id" sub_id (str): id of parameter, which h...
src/marcxml_parser/parser.py
def _parse_data_fields(self, fields, tag_id="tag", sub_id="code"): """ Parse data fields. Args: fields (list): of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
def _parse_data_fields(self, fields, tag_id="tag", sub_id="code"): """ Parse data fields. Args: fields (list): of HTMLElements tag_id (str): parameter name, which holds the information, about field name this is normally "tag", but in case of ...
[ "Parse", "data", "fields", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L147-L196
[ "def", "_parse_data_fields", "(", "self", ",", "fields", ",", "tag_id", "=", "\"tag\"", ",", "sub_id", "=", "\"code\"", ")", ":", "for", "field", "in", "fields", ":", "params", "=", "field", ".", "params", "if", "tag_id", "not", "in", "params", ":", "c...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.add_ctl_field
Add new control field `value` with under `name` into control field dictionary :attr:`controlfields`.
src/marcxml_parser/parser.py
def add_ctl_field(self, name, value): """ Add new control field `value` with under `name` into control field dictionary :attr:`controlfields`. """ if len(name) != 3: raise ValueError("name parameter have to be exactly 3 chars long!") self.controlfields[name] ...
def add_ctl_field(self, name, value): """ Add new control field `value` with under `name` into control field dictionary :attr:`controlfields`. """ if len(name) != 3: raise ValueError("name parameter have to be exactly 3 chars long!") self.controlfields[name] ...
[ "Add", "new", "control", "field", "value", "with", "under", "name", "into", "control", "field", "dictionary", ":", "attr", ":", "controlfields", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L198-L206
[ "def", "add_ctl_field", "(", "self", ",", "name", ",", "value", ")", ":", "if", "len", "(", "name", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"name parameter have to be exactly 3 chars long!\"", ")", "self", ".", "controlfields", "[", "name", "]", "...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.add_data_field
Add new datafield into :attr:`datafields` and take care of OAI MARC differencies. Args: name (str): Name of datafield. i1 (char): Value of i1/ind1 parameter. i2 (char): Value of i2/ind2 parameter. subfields_dict (dict): Dictionary containing subfields (as...
src/marcxml_parser/parser.py
def add_data_field(self, name, i1, i2, subfields_dict): """ Add new datafield into :attr:`datafields` and take care of OAI MARC differencies. Args: name (str): Name of datafield. i1 (char): Value of i1/ind1 parameter. i2 (char): Value of i2/ind2 param...
def add_data_field(self, name, i1, i2, subfields_dict): """ Add new datafield into :attr:`datafields` and take care of OAI MARC differencies. Args: name (str): Name of datafield. i1 (char): Value of i1/ind1 parameter. i2 (char): Value of i2/ind2 param...
[ "Add", "new", "datafield", "into", ":", "attr", ":", "datafields", "and", "take", "care", "of", "OAI", "MARC", "differencies", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L208-L288
[ "def", "add_data_field", "(", "self", ",", "name", ",", "i1", ",", "i2", ",", "subfields_dict", ")", ":", "if", "i1", "not", "in", "self", ".", "valid_i_chars", ":", "raise", "ValueError", "(", "\"Invalid i1 parameter '\"", "+", "i1", "+", "\"'!\"", ")", ...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.get_i_name
This method is used mainly internally, but it can be handy if you work with with raw MARC XML object and not using getters. Args: num (int): Which indicator you need (1/2). is_oai (bool/None): If None, :attr:`.oai_marc` is used. Returns: s...
src/marcxml_parser/parser.py
def get_i_name(self, num, is_oai=None): """ This method is used mainly internally, but it can be handy if you work with with raw MARC XML object and not using getters. Args: num (int): Which indicator you need (1/2). is_oai (bool/None): If None, :attr:`.oai_marc`...
def get_i_name(self, num, is_oai=None): """ This method is used mainly internally, but it can be handy if you work with with raw MARC XML object and not using getters. Args: num (int): Which indicator you need (1/2). is_oai (bool/None): If None, :attr:`.oai_marc`...
[ "This", "method", "is", "used", "mainly", "internally", "but", "it", "can", "be", "handy", "if", "you", "work", "with", "with", "raw", "MARC", "XML", "object", "and", "not", "using", "getters", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L290-L312
[ "def", "get_i_name", "(", "self", ",", "num", ",", "is_oai", "=", "None", ")", ":", "if", "num", "not", "in", "(", "1", ",", "2", ")", ":", "raise", "ValueError", "(", "\"`num` parameter have to be 1 or 2!\"", ")", "if", "is_oai", "is", "None", ":", "i...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.get_ctl_field
Method wrapper over :attr:`.controlfields` dictionary. Args: controlfield (str): Name of the controlfield. alt (object, default None): Alternative value of the `controlfield` when `controlfield` couldn't be found. Returns: str: record from given `con...
src/marcxml_parser/parser.py
def get_ctl_field(self, controlfield, alt=None): """ Method wrapper over :attr:`.controlfields` dictionary. Args: controlfield (str): Name of the controlfield. alt (object, default None): Alternative value of the `controlfield` when `controlfield` couldn'...
def get_ctl_field(self, controlfield, alt=None): """ Method wrapper over :attr:`.controlfields` dictionary. Args: controlfield (str): Name of the controlfield. alt (object, default None): Alternative value of the `controlfield` when `controlfield` couldn'...
[ "Method", "wrapper", "over", ":", "attr", ":", ".", "controlfields", "dictionary", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L328-L343
[ "def", "get_ctl_field", "(", "self", ",", "controlfield", ",", "alt", "=", "None", ")", ":", "if", "not", "alt", ":", "return", "self", ".", "controlfields", "[", "controlfield", "]", "return", "self", ".", "controlfields", ".", "get", "(", "controlfield",...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.getDataRecords
.. deprecated:: Use :func:`get_subfields` instead.
src/marcxml_parser/parser.py
def getDataRecords(self, datafield, subfield, throw_exceptions=True): """ .. deprecated:: Use :func:`get_subfields` instead. """ return self.get_subfields( datafield=datafield, subfield=subfield, exception=throw_exceptions )
def getDataRecords(self, datafield, subfield, throw_exceptions=True): """ .. deprecated:: Use :func:`get_subfields` instead. """ return self.get_subfields( datafield=datafield, subfield=subfield, exception=throw_exceptions )
[ "..", "deprecated", "::", "Use", ":", "func", ":", "get_subfields", "instead", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L345-L354
[ "def", "getDataRecords", "(", "self", ",", "datafield", ",", "subfield", ",", "throw_exceptions", "=", "True", ")", ":", "return", "self", ".", "get_subfields", "(", "datafield", "=", "datafield", ",", "subfield", "=", "subfield", ",", "exception", "=", "thr...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
MARCXMLParser.get_subfields
Return content of given `subfield` in `datafield`. Args: datafield (str): Section name (for example "001", "100", "700"). subfield (str): Subfield name (for example "a", "1", etc..). i1 (str, default None): Optional i1/ind1 parameter value, which will be used...
src/marcxml_parser/parser.py
def get_subfields(self, datafield, subfield, i1=None, i2=None, exception=False): """ Return content of given `subfield` in `datafield`. Args: datafield (str): Section name (for example "001", "100", "700"). subfield (str): Subfield name (for exampl...
def get_subfields(self, datafield, subfield, i1=None, i2=None, exception=False): """ Return content of given `subfield` in `datafield`. Args: datafield (str): Section name (for example "001", "100", "700"). subfield (str): Subfield name (for exampl...
[ "Return", "content", "of", "given", "subfield", "in", "datafield", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/parser.py#L356-L423
[ "def", "get_subfields", "(", "self", ",", "datafield", ",", "subfield", ",", "i1", "=", "None", ",", "i2", "=", "None", ",", "exception", "=", "False", ")", ":", "if", "len", "(", "datafield", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"`data...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
timeit_block
测试代码块耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours) :param label: 代码块标签
python_utls/utils/timeit.py
def timeit_block(unit='s', label=""): """ 测试代码块耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours) :param label: 代码块标签 """ start = time.time() try: yield finally: _format(unit, time.time() - start, label)
def timeit_block(unit='s', label=""): """ 测试代码块耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours) :param label: 代码块标签 """ start = time.time() try: yield finally: _format(unit, time.time() - start, label)
[ "测试代码块耗时" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/timeit.py#L28-L39
[ "def", "timeit_block", "(", "unit", "=", "'s'", ",", "label", "=", "\"\"", ")", ":", "start", "=", "time", ".", "time", "(", ")", "try", ":", "yield", "finally", ":", "_format", "(", "unit", ",", "time", ".", "time", "(", ")", "-", "start", ",", ...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
timeit
测试函数耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours)
python_utls/utils/timeit.py
def timeit(unit='s'): """ 测试函数耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours) """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): start = time.time() _result = func(*args, **kwargs) _format(unit, time.time() - start, func....
def timeit(unit='s'): """ 测试函数耗时 :param unit: 时间单位,有 's','m','h' 可选(seconds,minutes,hours) """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): start = time.time() _result = func(*args, **kwargs) _format(unit, time.time() - start, func....
[ "测试函数耗时" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/timeit.py#L42-L56
[ "def", "timeit", "(", "unit", "=", "'s'", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "start", "=", "time", ".", "time", "(", ")", "_r...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
_print
控制输出量
python_utls/utils/memoryit.py
def _print(stats, limit, label): """ 控制输出量 """ print("TraceMalloc for {}".format(label)) for index, stat in enumerate(stats): if index < limit: print(stat) else: break
def _print(stats, limit, label): """ 控制输出量 """ print("TraceMalloc for {}".format(label)) for index, stat in enumerate(stats): if index < limit: print(stat) else: break
[ "控制输出量" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/memoryit.py#L10-L19
[ "def", "_print", "(", "stats", ",", "limit", ",", "label", ")", ":", "print", "(", "\"TraceMalloc for {}\"", ".", "format", "(", "label", ")", ")", "for", "index", ",", "stat", "in", "enumerate", "(", "stats", ")", ":", "if", "index", "<", "limit", "...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
memoryit
追踪函数内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数
python_utls/utils/memoryit.py
def memoryit(group_by='lineno', limit=10): """ 追踪函数内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数 """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): tracemalloc.start() _start = tracemalloc.take_snaps...
def memoryit(group_by='lineno', limit=10): """ 追踪函数内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数 """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): tracemalloc.start() _start = tracemalloc.take_snaps...
[ "追踪函数内存消耗情况" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/memoryit.py#L22-L40
[ "def", "memoryit", "(", "group_by", "=", "'lineno'", ",", "limit", "=", "10", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "tracemalloc", "...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
memoryit_block
追踪代码块内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数 :param label: 代码块标签
python_utls/utils/memoryit.py
def memoryit_block(group_by='lineno', limit=10, label='code block'): """ 追踪代码块内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数 :param label: 代码块标签 """ tracemalloc.start() _start = tracemalloc.take_snapshot() try: yield finally: ...
def memoryit_block(group_by='lineno', limit=10, label='code block'): """ 追踪代码块内存消耗情况 :param group_by: 统计分组,有 'filename', 'lineno', 'traceback' 可选 :param limit: 限制输出行数 :param label: 代码块标签 """ tracemalloc.start() _start = tracemalloc.take_snapshot() try: yield finally: ...
[ "追踪代码块内存消耗情况" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/memoryit.py#L44-L59
[ "def", "memoryit_block", "(", "group_by", "=", "'lineno'", ",", "limit", "=", "10", ",", "label", "=", "'code block'", ")", ":", "tracemalloc", ".", "start", "(", ")", "_start", "=", "tracemalloc", ".", "take_snapshot", "(", ")", "try", ":", "yield", "fi...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
_get_params
Get the given param from each of the DOFs for a joint.
pagoda/physics.py
def _get_params(target, param, dof): '''Get the given param from each of the DOFs for a joint.''' return [target.getParam(getattr(ode, 'Param{}{}'.format(param, s))) for s in ['', '2', '3'][:dof]]
def _get_params(target, param, dof): '''Get the given param from each of the DOFs for a joint.''' return [target.getParam(getattr(ode, 'Param{}{}'.format(param, s))) for s in ['', '2', '3'][:dof]]
[ "Get", "the", "given", "param", "from", "each", "of", "the", "DOFs", "for", "a", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L478-L481
[ "def", "_get_params", "(", "target", ",", "param", ",", "dof", ")", ":", "return", "[", "target", ".", "getParam", "(", "getattr", "(", "ode", ",", "'Param{}{}'", ".", "format", "(", "param", ",", "s", ")", ")", ")", "for", "s", "in", "[", "''", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
_set_params
Set the given param for each of the DOFs for a joint.
pagoda/physics.py
def _set_params(target, param, values, dof): '''Set the given param for each of the DOFs for a joint.''' if not isinstance(values, (list, tuple, np.ndarray)): values = [values] * dof assert dof == len(values) for s, value in zip(['', '2', '3'][:dof], values): target.setParam(getattr(ode,...
def _set_params(target, param, values, dof): '''Set the given param for each of the DOFs for a joint.''' if not isinstance(values, (list, tuple, np.ndarray)): values = [values] * dof assert dof == len(values) for s, value in zip(['', '2', '3'][:dof], values): target.setParam(getattr(ode,...
[ "Set", "the", "given", "param", "for", "each", "of", "the", "DOFs", "for", "a", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L484-L490
[ "def", "_set_params", "(", "target", ",", "param", ",", "values", ",", "dof", ")", ":", "if", "not", "isinstance", "(", "values", ",", "(", "list", ",", "tuple", ",", "np", ".", "ndarray", ")", ")", ":", "values", "=", "[", "values", "]", "*", "d...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
make_quaternion
Given an angle and an axis, create a quaternion.
pagoda/physics.py
def make_quaternion(theta, *axis): '''Given an angle and an axis, create a quaternion.''' x, y, z = axis r = np.sqrt(x * x + y * y + z * z) st = np.sin(theta / 2.) ct = np.cos(theta / 2.) return [x * st / r, y * st / r, z * st / r, ct]
def make_quaternion(theta, *axis): '''Given an angle and an axis, create a quaternion.''' x, y, z = axis r = np.sqrt(x * x + y * y + z * z) st = np.sin(theta / 2.) ct = np.cos(theta / 2.) return [x * st / r, y * st / r, z * st / r, ct]
[ "Given", "an", "angle", "and", "an", "axis", "create", "a", "quaternion", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1085-L1091
[ "def", "make_quaternion", "(", "theta", ",", "*", "axis", ")", ":", "x", ",", "y", ",", "z", "=", "axis", "r", "=", "np", ".", "sqrt", "(", "x", "*", "x", "+", "y", "*", "y", "+", "z", "*", "z", ")", "st", "=", "np", ".", "sin", "(", "t...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
center_of_mass
Given a set of bodies, compute their center of mass in world coordinates.
pagoda/physics.py
def center_of_mass(bodies): '''Given a set of bodies, compute their center of mass in world coordinates. ''' x = np.zeros(3.) t = 0. for b in bodies: m = b.mass x += b.body_to_world(m.c) * m.mass t += m.mass return x / t
def center_of_mass(bodies): '''Given a set of bodies, compute their center of mass in world coordinates. ''' x = np.zeros(3.) t = 0. for b in bodies: m = b.mass x += b.body_to_world(m.c) * m.mass t += m.mass return x / t
[ "Given", "a", "set", "of", "bodies", "compute", "their", "center", "of", "mass", "in", "world", "coordinates", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1094-L1103
[ "def", "center_of_mass", "(", "bodies", ")", ":", "x", "=", "np", ".", "zeros", "(", "3.", ")", "t", "=", "0.", "for", "b", "in", "bodies", ":", "m", "=", "b", ".", "mass", "x", "+=", "b", ".", "body_to_world", "(", "m", ".", "c", ")", "*", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.state
The state of this body includes: - name of the body (str) - position (3-tuple) - quaternion (4-tuple) - linear velocity (3-tuple) - angular velocity (3-tuple)
pagoda/physics.py
def state(self): '''The state of this body includes: - name of the body (str) - position (3-tuple) - quaternion (4-tuple) - linear velocity (3-tuple) - angular velocity (3-tuple) ''' return BodyState(self.name, ...
def state(self): '''The state of this body includes: - name of the body (str) - position (3-tuple) - quaternion (4-tuple) - linear velocity (3-tuple) - angular velocity (3-tuple) ''' return BodyState(self.name, ...
[ "The", "state", "of", "this", "body", "includes", ":" ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L61-L74
[ "def", "state", "(", "self", ")", ":", "return", "BodyState", "(", "self", ".", "name", ",", "tuple", "(", "self", ".", "position", ")", ",", "tuple", "(", "self", ".", "quaternion", ")", ",", "tuple", "(", "self", ".", "linear_velocity", ")", ",", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.state
Set the state of this body. Parameters ---------- state : BodyState tuple The desired state of the body.
pagoda/physics.py
def state(self, state): '''Set the state of this body. Parameters ---------- state : BodyState tuple The desired state of the body. ''' assert self.name == state.name, \ 'state name "{}" != body name "{}"'.format(state.name, self.name) sel...
def state(self, state): '''Set the state of this body. Parameters ---------- state : BodyState tuple The desired state of the body. ''' assert self.name == state.name, \ 'state name "{}" != body name "{}"'.format(state.name, self.name) sel...
[ "Set", "the", "state", "of", "this", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L77-L90
[ "def", "state", "(", "self", ",", "state", ")", ":", "assert", "self", ".", "name", "==", "state", ".", "name", ",", "'state name \"{}\" != body name \"{}\"'", ".", "format", "(", "state", ".", "name", ",", "self", ".", "name", ")", "self", ".", "positio...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.rotation
Set the rotation of this body using a rotation matrix. Parameters ---------- rotation : sequence of 9 floats The desired rotation matrix for this body.
pagoda/physics.py
def rotation(self, rotation): '''Set the rotation of this body using a rotation matrix. Parameters ---------- rotation : sequence of 9 floats The desired rotation matrix for this body. ''' if isinstance(rotation, np.ndarray): rotation = rotation.r...
def rotation(self, rotation): '''Set the rotation of this body using a rotation matrix. Parameters ---------- rotation : sequence of 9 floats The desired rotation matrix for this body. ''' if isinstance(rotation, np.ndarray): rotation = rotation.r...
[ "Set", "the", "rotation", "of", "this", "body", "using", "a", "rotation", "matrix", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L114-L124
[ "def", "rotation", "(", "self", ",", "rotation", ")", ":", "if", "isinstance", "(", "rotation", ",", "np", ".", "ndarray", ")", ":", "rotation", "=", "rotation", ".", "ravel", "(", ")", "self", ".", "ode_body", ".", "setRotation", "(", "tuple", "(", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.is_kinematic
Set the kinematic/dynamic attribute for this body. In pagoda, kinematic bodies have infinite mass and do interact with other bodies via collisions. Parameters ---------- is_kinematic : bool If True, this body will be set to kinematic. If False, it will be ...
pagoda/physics.py
def is_kinematic(self, is_kinematic): '''Set the kinematic/dynamic attribute for this body. In pagoda, kinematic bodies have infinite mass and do interact with other bodies via collisions. Parameters ---------- is_kinematic : bool If True, this body will be ...
def is_kinematic(self, is_kinematic): '''Set the kinematic/dynamic attribute for this body. In pagoda, kinematic bodies have infinite mass and do interact with other bodies via collisions. Parameters ---------- is_kinematic : bool If True, this body will be ...
[ "Set", "the", "kinematic", "/", "dynamic", "attribute", "for", "this", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L205-L220
[ "def", "is_kinematic", "(", "self", ",", "is_kinematic", ")", ":", "if", "is_kinematic", ":", "self", ".", "ode_body", ".", "setKinematic", "(", ")", "else", ":", "self", ".", "ode_body", ".", "setDynamic", "(", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.body_to_world
Convert a body-relative offset to world coordinates. Parameters ---------- position : 3-tuple of float A tuple giving body-relative offsets. Returns ------- position : 3-tuple of float A tuple giving the world coordinates of the given offset.
pagoda/physics.py
def body_to_world(self, position): '''Convert a body-relative offset to world coordinates. Parameters ---------- position : 3-tuple of float A tuple giving body-relative offsets. Returns ------- position : 3-tuple of float A tuple giving ...
def body_to_world(self, position): '''Convert a body-relative offset to world coordinates. Parameters ---------- position : 3-tuple of float A tuple giving body-relative offsets. Returns ------- position : 3-tuple of float A tuple giving ...
[ "Convert", "a", "body", "-", "relative", "offset", "to", "world", "coordinates", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L253-L266
[ "def", "body_to_world", "(", "self", ",", "position", ")", ":", "return", "np", ".", "array", "(", "self", ".", "ode_body", ".", "getRelPointPos", "(", "tuple", "(", "position", ")", ")", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.world_to_body
Convert a point in world coordinates to a body-relative offset. Parameters ---------- position : 3-tuple of float A world coordinates position. Returns ------- offset : 3-tuple of float A tuple giving the body-relative offset of the given positio...
pagoda/physics.py
def world_to_body(self, position): '''Convert a point in world coordinates to a body-relative offset. Parameters ---------- position : 3-tuple of float A world coordinates position. Returns ------- offset : 3-tuple of float A tuple giving...
def world_to_body(self, position): '''Convert a point in world coordinates to a body-relative offset. Parameters ---------- position : 3-tuple of float A world coordinates position. Returns ------- offset : 3-tuple of float A tuple giving...
[ "Convert", "a", "point", "in", "world", "coordinates", "to", "a", "body", "-", "relative", "offset", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L268-L281
[ "def", "world_to_body", "(", "self", ",", "position", ")", ":", "return", "np", ".", "array", "(", "self", ".", "ode_body", ".", "getPosRelPoint", "(", "tuple", "(", "position", ")", ")", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.relative_offset_to_world
Convert a relative body offset to world coordinates. Parameters ---------- offset : 3-tuple of float The offset of the desired point, given as a relative fraction of the size of this body. For example, offset (0, 0, 0) is the center of the body, while (0.5, -...
pagoda/physics.py
def relative_offset_to_world(self, offset): '''Convert a relative body offset to world coordinates. Parameters ---------- offset : 3-tuple of float The offset of the desired point, given as a relative fraction of the size of this body. For example, offset (0, 0, ...
def relative_offset_to_world(self, offset): '''Convert a relative body offset to world coordinates. Parameters ---------- offset : 3-tuple of float The offset of the desired point, given as a relative fraction of the size of this body. For example, offset (0, 0, ...
[ "Convert", "a", "relative", "body", "offset", "to", "world", "coordinates", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L283-L301
[ "def", "relative_offset_to_world", "(", "self", ",", "offset", ")", ":", "return", "np", ".", "array", "(", "self", ".", "body_to_world", "(", "offset", "*", "self", ".", "dimensions", "/", "2", ")", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.add_force
Add a force to this body. Parameters ---------- force : 3-tuple of float A vector giving the forces along each world or body coordinate axis. relative : bool, optional If False, the force values are assumed to be given in the world coordinate frame. I...
pagoda/physics.py
def add_force(self, force, relative=False, position=None, relative_position=None): '''Add a force to this body. Parameters ---------- force : 3-tuple of float A vector giving the forces along each world or body coordinate axis. relative : bool, optional I...
def add_force(self, force, relative=False, position=None, relative_position=None): '''Add a force to this body. Parameters ---------- force : 3-tuple of float A vector giving the forces along each world or body coordinate axis. relative : bool, optional I...
[ "Add", "a", "force", "to", "this", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L303-L330
[ "def", "add_force", "(", "self", ",", "force", ",", "relative", "=", "False", ",", "position", "=", "None", ",", "relative_position", "=", "None", ")", ":", "b", "=", "self", ".", "ode_body", "if", "relative_position", "is", "not", "None", ":", "op", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.add_torque
Add a torque to this body. Parameters ---------- force : 3-tuple of float A vector giving the torque along each world or body coordinate axis. relative : bool, optional If False, the torque values are assumed to be given in the world coordinate frame....
pagoda/physics.py
def add_torque(self, torque, relative=False): '''Add a torque to this body. Parameters ---------- force : 3-tuple of float A vector giving the torque along each world or body coordinate axis. relative : bool, optional If False, the torque values are assum...
def add_torque(self, torque, relative=False): '''Add a torque to this body. Parameters ---------- force : 3-tuple of float A vector giving the torque along each world or body coordinate axis. relative : bool, optional If False, the torque values are assum...
[ "Add", "a", "torque", "to", "this", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L332-L345
[ "def", "add_torque", "(", "self", ",", "torque", ",", "relative", "=", "False", ")", ":", "op", "=", "self", ".", "ode_body", ".", "addRelTorque", "if", "relative", "else", "self", ".", "ode_body", ".", "addTorque", "op", "(", "torque", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.join_to
Connect this body to another one using a joint. This method creates a joint to fasten this body to the other one. See :func:`World.join`. Parameters ---------- joint : str The type of joint to use when connecting these bodies. other_body : :class:`Body` or s...
pagoda/physics.py
def join_to(self, joint, other_body=None, **kwargs): '''Connect this body to another one using a joint. This method creates a joint to fasten this body to the other one. See :func:`World.join`. Parameters ---------- joint : str The type of joint to use when ...
def join_to(self, joint, other_body=None, **kwargs): '''Connect this body to another one using a joint. This method creates a joint to fasten this body to the other one. See :func:`World.join`. Parameters ---------- joint : str The type of joint to use when ...
[ "Connect", "this", "body", "to", "another", "one", "using", "a", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L347-L361
[ "def", "join_to", "(", "self", ",", "joint", ",", "other_body", "=", "None", ",", "*", "*", "kwargs", ")", ":", "self", ".", "world", ".", "join", "(", "joint", ",", "self", ",", "other_body", ",", "*", "*", "kwargs", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Body.connect_to
Move another body next to this one and join them together. This method will move the ``other_body`` so that the anchor points for the joint coincide. It then creates a joint to fasten the two bodies together. See :func:`World.move_next_to` and :func:`World.join`. Parameters ---...
pagoda/physics.py
def connect_to(self, joint, other_body, offset=(0, 0, 0), other_offset=(0, 0, 0), **kwargs): '''Move another body next to this one and join them together. This method will move the ``other_body`` so that the anchor points for the joint coincide. It then creates a joint to fas...
def connect_to(self, joint, other_body, offset=(0, 0, 0), other_offset=(0, 0, 0), **kwargs): '''Move another body next to this one and join them together. This method will move the ``other_body`` so that the anchor points for the joint coincide. It then creates a joint to fas...
[ "Move", "another", "body", "next", "to", "this", "one", "and", "join", "them", "together", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L363-L387
[ "def", "connect_to", "(", "self", ",", "joint", ",", "other_body", ",", "offset", "=", "(", "0", ",", "0", ",", "0", ")", ",", "other_offset", "=", "(", "0", ",", "0", ",", "0", ")", ",", "*", "*", "kwargs", ")", ":", "anchor", "=", "self", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.positions
List of positions for linear degrees of freedom.
pagoda/physics.py
def positions(self): '''List of positions for linear degrees of freedom.''' return [self.ode_obj.getPosition(i) for i in range(self.LDOF)]
def positions(self): '''List of positions for linear degrees of freedom.''' return [self.ode_obj.getPosition(i) for i in range(self.LDOF)]
[ "List", "of", "positions", "for", "linear", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L527-L529
[ "def", "positions", "(", "self", ")", ":", "return", "[", "self", ".", "ode_obj", ".", "getPosition", "(", "i", ")", "for", "i", "in", "range", "(", "self", ".", "LDOF", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.position_rates
List of position rates for linear degrees of freedom.
pagoda/physics.py
def position_rates(self): '''List of position rates for linear degrees of freedom.''' return [self.ode_obj.getPositionRate(i) for i in range(self.LDOF)]
def position_rates(self): '''List of position rates for linear degrees of freedom.''' return [self.ode_obj.getPositionRate(i) for i in range(self.LDOF)]
[ "List", "of", "position", "rates", "for", "linear", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L532-L534
[ "def", "position_rates", "(", "self", ")", ":", "return", "[", "self", ".", "ode_obj", ".", "getPositionRate", "(", "i", ")", "for", "i", "in", "range", "(", "self", ".", "LDOF", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.angles
List of angles for rotational degrees of freedom.
pagoda/physics.py
def angles(self): '''List of angles for rotational degrees of freedom.''' return [self.ode_obj.getAngle(i) for i in range(self.ADOF)]
def angles(self): '''List of angles for rotational degrees of freedom.''' return [self.ode_obj.getAngle(i) for i in range(self.ADOF)]
[ "List", "of", "angles", "for", "rotational", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L537-L539
[ "def", "angles", "(", "self", ")", ":", "return", "[", "self", ".", "ode_obj", ".", "getAngle", "(", "i", ")", "for", "i", "in", "range", "(", "self", ".", "ADOF", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.angle_rates
List of angle rates for rotational degrees of freedom.
pagoda/physics.py
def angle_rates(self): '''List of angle rates for rotational degrees of freedom.''' return [self.ode_obj.getAngleRate(i) for i in range(self.ADOF)]
def angle_rates(self): '''List of angle rates for rotational degrees of freedom.''' return [self.ode_obj.getAngleRate(i) for i in range(self.ADOF)]
[ "List", "of", "angle", "rates", "for", "rotational", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L542-L544
[ "def", "angle_rates", "(", "self", ")", ":", "return", "[", "self", ".", "ode_obj", ".", "getAngleRate", "(", "i", ")", "for", "i", "in", "range", "(", "self", ".", "ADOF", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.axes
List of axes for this object's degrees of freedom.
pagoda/physics.py
def axes(self): '''List of axes for this object's degrees of freedom.''' return [np.array(self.ode_obj.getAxis(i)) for i in range(self.ADOF or self.LDOF)]
def axes(self): '''List of axes for this object's degrees of freedom.''' return [np.array(self.ode_obj.getAxis(i)) for i in range(self.ADOF or self.LDOF)]
[ "List", "of", "axes", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L547-L550
[ "def", "axes", "(", "self", ")", ":", "return", "[", "np", ".", "array", "(", "self", ".", "ode_obj", ".", "getAxis", "(", "i", ")", ")", "for", "i", "in", "range", "(", "self", ".", "ADOF", "or", "self", ".", "LDOF", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.axes
Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axes specifications A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE object. Each element can ...
pagoda/physics.py
def axes(self, axes): '''Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axes specifications A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE obje...
def axes(self, axes): '''Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axes specifications A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE obje...
[ "Set", "the", "axes", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L553-L569
[ "def", "axes", "(", "self", ",", "axes", ")", ":", "assert", "self", ".", "ADOF", "==", "len", "(", "axes", ")", "or", "self", ".", "LDOF", "==", "len", "(", "axes", ")", "for", "i", ",", "axis", "in", "enumerate", "(", "axes", ")", ":", "if", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.lo_stops
Set the lo stop values for this object's degrees of freedom. Parameters ---------- lo_stops : float or sequence of float A lo stop value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. For rotational degrees o...
pagoda/physics.py
def lo_stops(self, lo_stops): '''Set the lo stop values for this object's degrees of freedom. Parameters ---------- lo_stops : float or sequence of float A lo stop value to set on all degrees of freedom, or a list containing one such value for each degree of free...
def lo_stops(self, lo_stops): '''Set the lo stop values for this object's degrees of freedom. Parameters ---------- lo_stops : float or sequence of float A lo stop value to set on all degrees of freedom, or a list containing one such value for each degree of free...
[ "Set", "the", "lo", "stop", "values", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L577-L587
[ "def", "lo_stops", "(", "self", ",", "lo_stops", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'LoStop'", ",", "lo_stops", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.hi_stops
Set the hi stop values for this object's degrees of freedom. Parameters ---------- hi_stops : float or sequence of float A hi stop value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. For rotational degrees o...
pagoda/physics.py
def hi_stops(self, hi_stops): '''Set the hi stop values for this object's degrees of freedom. Parameters ---------- hi_stops : float or sequence of float A hi stop value to set on all degrees of freedom, or a list containing one such value for each degree of free...
def hi_stops(self, hi_stops): '''Set the hi stop values for this object's degrees of freedom. Parameters ---------- hi_stops : float or sequence of float A hi stop value to set on all degrees of freedom, or a list containing one such value for each degree of free...
[ "Set", "the", "hi", "stop", "values", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L595-L605
[ "def", "hi_stops", "(", "self", ",", "hi_stops", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'HiStop'", ",", "hi_stops", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.velocities
Set the target velocities for this object's degrees of freedom. Parameters ---------- velocities : float or sequence of float A target velocity value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. For rotational ...
pagoda/physics.py
def velocities(self, velocities): '''Set the target velocities for this object's degrees of freedom. Parameters ---------- velocities : float or sequence of float A target velocity value to set on all degrees of freedom, or a list containing one such value for ea...
def velocities(self, velocities): '''Set the target velocities for this object's degrees of freedom. Parameters ---------- velocities : float or sequence of float A target velocity value to set on all degrees of freedom, or a list containing one such value for ea...
[ "Set", "the", "target", "velocities", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L613-L623
[ "def", "velocities", "(", "self", ",", "velocities", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'Vel'", ",", "velocities", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.max_forces
Set the maximum forces for this object's degrees of freedom. Parameters ---------- max_forces : float or sequence of float A maximum force value to set on all degrees of freedom, or a list containing one such value for each degree of freedom.
pagoda/physics.py
def max_forces(self, max_forces): '''Set the maximum forces for this object's degrees of freedom. Parameters ---------- max_forces : float or sequence of float A maximum force value to set on all degrees of freedom, or a list containing one such value for each de...
def max_forces(self, max_forces): '''Set the maximum forces for this object's degrees of freedom. Parameters ---------- max_forces : float or sequence of float A maximum force value to set on all degrees of freedom, or a list containing one such value for each de...
[ "Set", "the", "maximum", "forces", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L631-L640
[ "def", "max_forces", "(", "self", ",", "max_forces", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'FMax'", ",", "max_forces", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.erps
Set the ERP values for this object's degrees of freedom. Parameters ---------- erps : float or sequence of float An ERP value to set on all degrees of freedom, or a list containing one such value for each degree of freedom.
pagoda/physics.py
def erps(self, erps): '''Set the ERP values for this object's degrees of freedom. Parameters ---------- erps : float or sequence of float An ERP value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. ''' ...
def erps(self, erps): '''Set the ERP values for this object's degrees of freedom. Parameters ---------- erps : float or sequence of float An ERP value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. ''' ...
[ "Set", "the", "ERP", "values", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L648-L657
[ "def", "erps", "(", "self", ",", "erps", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'ERP'", ",", "erps", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.cfms
Set the CFM values for this object's degrees of freedom. Parameters ---------- cfms : float or sequence of float A CFM value to set on all degrees of freedom, or a list containing one such value for each degree of freedom.
pagoda/physics.py
def cfms(self, cfms): '''Set the CFM values for this object's degrees of freedom. Parameters ---------- cfms : float or sequence of float A CFM value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. ''' ...
def cfms(self, cfms): '''Set the CFM values for this object's degrees of freedom. Parameters ---------- cfms : float or sequence of float A CFM value to set on all degrees of freedom, or a list containing one such value for each degree of freedom. ''' ...
[ "Set", "the", "CFM", "values", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L665-L674
[ "def", "cfms", "(", "self", ",", "cfms", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'CFM'", ",", "cfms", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.stop_cfms
Set the CFM values for this object's DOF limits. Parameters ---------- stop_cfms : float or sequence of float A CFM value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom limit.
pagoda/physics.py
def stop_cfms(self, stop_cfms): '''Set the CFM values for this object's DOF limits. Parameters ---------- stop_cfms : float or sequence of float A CFM value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom li...
def stop_cfms(self, stop_cfms): '''Set the CFM values for this object's DOF limits. Parameters ---------- stop_cfms : float or sequence of float A CFM value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom li...
[ "Set", "the", "CFM", "values", "for", "this", "object", "s", "DOF", "limits", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L682-L691
[ "def", "stop_cfms", "(", "self", ",", "stop_cfms", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'StopCFM'", ",", "stop_cfms", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Joint.stop_erps
Set the ERP values for this object's DOF limits. Parameters ---------- stop_erps : float or sequence of float An ERP value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom limit.
pagoda/physics.py
def stop_erps(self, stop_erps): '''Set the ERP values for this object's DOF limits. Parameters ---------- stop_erps : float or sequence of float An ERP value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom l...
def stop_erps(self, stop_erps): '''Set the ERP values for this object's DOF limits. Parameters ---------- stop_erps : float or sequence of float An ERP value to set on all degrees of freedom limits, or a list containing one such value for each degree of freedom l...
[ "Set", "the", "ERP", "values", "for", "this", "object", "s", "DOF", "limits", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L699-L708
[ "def", "stop_erps", "(", "self", ",", "stop_erps", ")", ":", "_set_params", "(", "self", ".", "ode_obj", ",", "'StopERP'", ",", "stop_erps", ",", "self", ".", "ADOF", "+", "self", ".", "LDOF", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
AMotor.axes
Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axis parameters A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE object. Each element can be ...
pagoda/physics.py
def axes(self, axes): '''Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axis parameters A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE object. ...
def axes(self, axes): '''Set the axes for this object's degrees of freedom. Parameters ---------- axes : list of axis parameters A list of axis values to set. This list must have the same number of elements as the degrees of freedom of the underlying ODE object. ...
[ "Set", "the", "axes", "for", "this", "object", "s", "degrees", "of", "freedom", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L785-L807
[ "def", "axes", "(", "self", ",", "axes", ")", ":", "assert", "len", "(", "axes", ")", "==", "self", ".", "ADOF", "for", "i", ",", "ax", "in", "enumerate", "(", "axes", ")", ":", "if", "ax", "is", "None", ":", "continue", "if", "not", "isinstance"...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Slider.axes
Set the linear axis of displacement for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a slider joint, which has one degree of freedom, this must contain one 3-tuple specifying the X, Y, a...
pagoda/physics.py
def axes(self, axes): '''Set the linear axis of displacement for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a slider joint, which has one degree of freedom, this must contain one 3-tuple s...
def axes(self, axes): '''Set the linear axis of displacement for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a slider joint, which has one degree of freedom, this must contain one 3-tuple s...
[ "Set", "the", "linear", "axis", "of", "displacement", "for", "this", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L943-L954
[ "def", "axes", "(", "self", ",", "axes", ")", ":", "self", ".", "lmotor", ".", "axes", "=", "[", "axes", "[", "0", "]", "]", "self", ".", "ode_obj", ".", "setAxis", "(", "tuple", "(", "axes", "[", "0", "]", ")", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Hinge.axes
Set the angular axis of rotation for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a hinge joint, which has one degree of freedom, this must contain one 3-tuple specifying the X, Y, and Z...
pagoda/physics.py
def axes(self, axes): '''Set the angular axis of rotation for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a hinge joint, which has one degree of freedom, this must contain one 3-tuple speci...
def axes(self, axes): '''Set the angular axis of rotation for this joint. Parameters ---------- axes : list containing one 3-tuple of floats A list of the axes for this joint. For a hinge joint, which has one degree of freedom, this must contain one 3-tuple speci...
[ "Set", "the", "angular", "axis", "of", "rotation", "for", "this", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L977-L988
[ "def", "axes", "(", "self", ",", "axes", ")", ":", "self", ".", "amotor", ".", "axes", "=", "[", "axes", "[", "0", "]", "]", "self", ".", "ode_obj", ".", "setAxis", "(", "tuple", "(", "axes", "[", "0", "]", ")", ")" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
Universal.axes
A list of axes of rotation for this joint.
pagoda/physics.py
def axes(self): '''A list of axes of rotation for this joint.''' return [np.array(self.ode_obj.getAxis1()), np.array(self.ode_obj.getAxis2())]
def axes(self): '''A list of axes of rotation for this joint.''' return [np.array(self.ode_obj.getAxis1()), np.array(self.ode_obj.getAxis2())]
[ "A", "list", "of", "axes", "of", "rotation", "for", "this", "joint", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1012-L1015
[ "def", "axes", "(", "self", ")", ":", "return", "[", "np", ".", "array", "(", "self", ".", "ode_obj", ".", "getAxis1", "(", ")", ")", ",", "np", ".", "array", "(", "self", ".", "ode_obj", ".", "getAxis2", "(", ")", ")", "]" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.create_body
Create a new body. Parameters ---------- shape : str The "shape" of the body to be created. This should name a type of body object, e.g., "box" or "cap". name : str, optional The name to use for this body. If not given, a default name will be ...
pagoda/physics.py
def create_body(self, shape, name=None, **kwargs): '''Create a new body. Parameters ---------- shape : str The "shape" of the body to be created. This should name a type of body object, e.g., "box" or "cap". name : str, optional The name to us...
def create_body(self, shape, name=None, **kwargs): '''Create a new body. Parameters ---------- shape : str The "shape" of the body to be created. This should name a type of body object, e.g., "box" or "cap". name : str, optional The name to us...
[ "Create", "a", "new", "body", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1219-L1243
[ "def", "create_body", "(", "self", ",", "shape", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "shape", "=", "shape", ".", "lower", "(", ")", "if", "name", "is", "None", ":", "for", "i", "in", "range", "(", "1", "+", "len", "(", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.join
Create a new joint that connects two bodies together. Parameters ---------- shape : str The "shape" of the joint to use for joining together two bodies. This should name a type of joint, such as "ball" or "piston". body_a : str or :class:`Body` The fi...
pagoda/physics.py
def join(self, shape, body_a, body_b=None, name=None, **kwargs): '''Create a new joint that connects two bodies together. Parameters ---------- shape : str The "shape" of the joint to use for joining together two bodies. This should name a type of joint, such as ...
def join(self, shape, body_a, body_b=None, name=None, **kwargs): '''Create a new joint that connects two bodies together. Parameters ---------- shape : str The "shape" of the joint to use for joining together two bodies. This should name a type of joint, such as ...
[ "Create", "a", "new", "joint", "that", "connects", "two", "bodies", "together", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1245-L1277
[ "def", "join", "(", "self", ",", "shape", ",", "body_a", ",", "body_b", "=", "None", ",", "name", "=", "None", ",", "*", "*", "kwargs", ")", ":", "ba", "=", "self", ".", "get_body", "(", "body_a", ")", "bb", "=", "self", ".", "get_body", "(", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.move_next_to
Move one body to be near another one. After moving, the location described by ``offset_a`` on ``body_a`` will be coincident with the location described by ``offset_b`` on ``body_b``. Parameters ---------- body_a : str or :class:`Body` The body to use as a reference ...
pagoda/physics.py
def move_next_to(self, body_a, body_b, offset_a, offset_b): '''Move one body to be near another one. After moving, the location described by ``offset_a`` on ``body_a`` will be coincident with the location described by ``offset_b`` on ``body_b``. Parameters ---------- bo...
def move_next_to(self, body_a, body_b, offset_a, offset_b): '''Move one body to be near another one. After moving, the location described by ``offset_a`` on ``body_a`` will be coincident with the location described by ``offset_b`` on ``body_b``. Parameters ---------- bo...
[ "Move", "one", "body", "to", "be", "near", "another", "one", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1279-L1316
[ "def", "move_next_to", "(", "self", ",", "body_a", ",", "body_b", ",", "offset_a", ",", "offset_b", ")", ":", "ba", "=", "self", ".", "get_body", "(", "body_a", ")", "bb", "=", "self", ".", "get_body", "(", "body_b", ")", "if", "ba", "is", "None", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.set_body_states
Set the states of some bodies in the world. Parameters ---------- states : sequence of states A complete state tuple for one or more bodies in the world. See :func:`get_body_states`.
pagoda/physics.py
def set_body_states(self, states): '''Set the states of some bodies in the world. Parameters ---------- states : sequence of states A complete state tuple for one or more bodies in the world. See :func:`get_body_states`. ''' for state in states: ...
def set_body_states(self, states): '''Set the states of some bodies in the world. Parameters ---------- states : sequence of states A complete state tuple for one or more bodies in the world. See :func:`get_body_states`. ''' for state in states: ...
[ "Set", "the", "states", "of", "some", "bodies", "in", "the", "world", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1329-L1339
[ "def", "set_body_states", "(", "self", ",", "states", ")", ":", "for", "state", "in", "states", ":", "self", ".", "get_body", "(", "state", ".", "name", ")", ".", "state", "=", "state" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.step
Step the world forward by one frame. Parameters ---------- substeps : int, optional Split the step into this many sub-steps. This helps to prevent the time delta for an update from being too large.
pagoda/physics.py
def step(self, substeps=2): '''Step the world forward by one frame. Parameters ---------- substeps : int, optional Split the step into this many sub-steps. This helps to prevent the time delta for an update from being too large. ''' self.frame_no ...
def step(self, substeps=2): '''Step the world forward by one frame. Parameters ---------- substeps : int, optional Split the step into this many sub-steps. This helps to prevent the time delta for an update from being too large. ''' self.frame_no ...
[ "Step", "the", "world", "forward", "by", "one", "frame", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1341-L1355
[ "def", "step", "(", "self", ",", "substeps", "=", "2", ")", ":", "self", ".", "frame_no", "+=", "1", "dt", "=", "self", ".", "dt", "/", "substeps", "for", "_", "in", "range", "(", "substeps", ")", ":", "self", ".", "ode_contactgroup", ".", "empty",...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.on_key_press
Handle an otherwise unhandled keypress event (from a GUI).
pagoda/physics.py
def on_key_press(self, key, modifiers, keymap): '''Handle an otherwise unhandled keypress event (from a GUI).''' if key == keymap.ENTER: self.reset() return True
def on_key_press(self, key, modifiers, keymap): '''Handle an otherwise unhandled keypress event (from a GUI).''' if key == keymap.ENTER: self.reset() return True
[ "Handle", "an", "otherwise", "unhandled", "keypress", "event", "(", "from", "a", "GUI", ")", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1365-L1369
[ "def", "on_key_press", "(", "self", ",", "key", ",", "modifiers", ",", "keymap", ")", ":", "if", "key", "==", "keymap", ".", "ENTER", ":", "self", ".", "reset", "(", ")", "return", "True" ]
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.are_connected
Determine whether the given bodies are currently connected. Parameters ---------- body_a : str or :class:`Body` One body to test for connectedness. If this is a string, it is treated as the name of a body to look up. body_b : str or :class:`Body` One ...
pagoda/physics.py
def are_connected(self, body_a, body_b): '''Determine whether the given bodies are currently connected. Parameters ---------- body_a : str or :class:`Body` One body to test for connectedness. If this is a string, it is treated as the name of a body to look up. ...
def are_connected(self, body_a, body_b): '''Determine whether the given bodies are currently connected. Parameters ---------- body_a : str or :class:`Body` One body to test for connectedness. If this is a string, it is treated as the name of a body to look up. ...
[ "Determine", "whether", "the", "given", "bodies", "are", "currently", "connected", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1371-L1390
[ "def", "are_connected", "(", "self", ",", "body_a", ",", "body_b", ")", ":", "return", "bool", "(", "ode", ".", "areConnected", "(", "self", ".", "get_body", "(", "body_a", ")", ".", "ode_body", ",", "self", ".", "get_body", "(", "body_b", ")", ".", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
World.on_collision
Callback function for the collide() method. Parameters ---------- args : None Arguments passed when the callback was registered. Not used. geom_a : ODE geometry The geometry object of one of the bodies that has collided. geom_b : ODE geometry ...
pagoda/physics.py
def on_collision(self, args, geom_a, geom_b): '''Callback function for the collide() method. Parameters ---------- args : None Arguments passed when the callback was registered. Not used. geom_a : ODE geometry The geometry object of one of the bodies that...
def on_collision(self, args, geom_a, geom_b): '''Callback function for the collide() method. Parameters ---------- args : None Arguments passed when the callback was registered. Not used. geom_a : ODE geometry The geometry object of one of the bodies that...
[ "Callback", "function", "for", "the", "collide", "()", "method", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/physics.py#L1392-L1414
[ "def", "on_collision", "(", "self", ",", "args", ",", "geom_a", ",", "geom_b", ")", ":", "body_a", "=", "geom_a", ".", "getBody", "(", ")", "body_b", "=", "geom_b", ".", "getBody", "(", ")", "if", "ode", ".", "areConnected", "(", "body_a", ",", "body...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
record_iterator
Iterate over all ``<record>`` tags in `xml`. Args: xml (str/file): Input string with XML. UTF-8 is prefered encoding, unicode should be ok. Yields: MARCXMLRecord: For each corresponding ``<record>``.
src/marcxml_parser/record.py
def record_iterator(xml): """ Iterate over all ``<record>`` tags in `xml`. Args: xml (str/file): Input string with XML. UTF-8 is prefered encoding, unicode should be ok. Yields: MARCXMLRecord: For each corresponding ``<record>``. """ # handle file-like o...
def record_iterator(xml): """ Iterate over all ``<record>`` tags in `xml`. Args: xml (str/file): Input string with XML. UTF-8 is prefered encoding, unicode should be ok. Yields: MARCXMLRecord: For each corresponding ``<record>``. """ # handle file-like o...
[ "Iterate", "over", "all", "<record", ">", "tags", "in", "xml", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/record.py#L22-L44
[ "def", "record_iterator", "(", "xml", ")", ":", "# handle file-like objects", "if", "hasattr", "(", "xml", ",", "\"read\"", ")", ":", "xml", "=", "xml", ".", "read", "(", ")", "dom", "=", "None", "try", ":", "dom", "=", "dhtmlparser", ".", "parseString",...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820
valid
profileit
测试函数运行消耗情况 :param field: 输出内容排序方式。 可选参数为 "stdname", "calls", "time", "cumulative"
python_utls/utils/profileit.py
def profileit(field='cumulative'): """ 测试函数运行消耗情况 :param field: 输出内容排序方式。 可选参数为 "stdname", "calls", "time", "cumulative" """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): pro = Profile() pro.runcall(func, *args, **kwargs) sta...
def profileit(field='cumulative'): """ 测试函数运行消耗情况 :param field: 输出内容排序方式。 可选参数为 "stdname", "calls", "time", "cumulative" """ def wrapper(func): @wraps(func) def inner(*args, **kwargs): pro = Profile() pro.runcall(func, *args, **kwargs) sta...
[ "测试函数运行消耗情况" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/profileit.py#L9-L28
[ "def", "profileit", "(", "field", "=", "'cumulative'", ")", ":", "def", "wrapper", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "inner", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "pro", "=", "Profile", "(", ")", "pro",...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
parse
Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` The world to add objects and joints to. jointgroup : ode.JointGroup, op...
pagoda/parser.py
def parse(source, world, jointgroup=None, density=1000, color=None): '''Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` ...
def parse(source, world, jointgroup=None, density=1000, color=None): '''Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` ...
[ "Load", "and", "parse", "a", "source", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L14-L36
[ "def", "parse", "(", "source", ",", "world", ",", "jointgroup", "=", "None", ",", "density", "=", "1000", ",", "color", "=", "None", ")", ":", "visitor", "=", "Visitor", "(", "world", ",", "jointgroup", ",", "density", ",", "color", ")", "visitor", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
parse_asf
Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` The world to add objects and joints to. jointgroup : ode.JointGroup, op...
pagoda/parser.py
def parse_asf(source, world, jointgroup=None, density=1000, color=None): '''Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` ...
def parse_asf(source, world, jointgroup=None, density=1000, color=None): '''Load and parse a source file. Parameters ---------- source : file A file-like object that contains text information describing bodies and joints to add to the world. world : :class:`pagoda.physics.World` ...
[ "Load", "and", "parse", "a", "source", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L263-L285
[ "def", "parse_asf", "(", "source", ",", "world", ",", "jointgroup", "=", "None", ",", "density", "=", "1000", ",", "color", "=", "None", ")", ":", "visitor", "=", "AsfVisitor", "(", "world", ",", "jointgroup", ",", "density", ",", "color", ")", "visito...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
parse_amc
Parse an AMC motion capture data file. Parameters ---------- source : file A file-like object that contains AMC motion capture text. Yields ------ frame : dict Yields a series of motion capture frames. Each frame is a dictionary that maps a bone name to a list of the DO...
pagoda/parser.py
def parse_amc(source): '''Parse an AMC motion capture data file. Parameters ---------- source : file A file-like object that contains AMC motion capture text. Yields ------ frame : dict Yields a series of motion capture frames. Each frame is a dictionary that maps a...
def parse_amc(source): '''Parse an AMC motion capture data file. Parameters ---------- source : file A file-like object that contains AMC motion capture text. Yields ------ frame : dict Yields a series of motion capture frames. Each frame is a dictionary that maps a...
[ "Parse", "an", "AMC", "motion", "capture", "data", "file", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L486-L523
[ "def", "parse_amc", "(", "source", ")", ":", "lines", "=", "0", "frames", "=", "1", "frame", "=", "{", "}", "degrees", "=", "False", "for", "line", "in", "source", ":", "lines", "+=", "1", "line", "=", "line", ".", "split", "(", "'#'", ")", "[", ...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
AsfVisitor.create_bodies
Traverse the bone hierarchy and create physics bodies.
pagoda/parser.py
def create_bodies(self, translate=(0, 1, 0), size=0.1): '''Traverse the bone hierarchy and create physics bodies.''' stack = [('root', 0, self.root['position'] + translate)] while stack: name, depth, end = stack.pop() for child in self.hierarchy.get(name, ()): ...
def create_bodies(self, translate=(0, 1, 0), size=0.1): '''Traverse the bone hierarchy and create physics bodies.''' stack = [('root', 0, self.root['position'] + translate)] while stack: name, depth, end = stack.pop() for child in self.hierarchy.get(name, ()): ...
[ "Traverse", "the", "bone", "hierarchy", "and", "create", "physics", "bodies", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L430-L466
[ "def", "create_bodies", "(", "self", ",", "translate", "=", "(", "0", ",", "1", ",", "0", ")", ",", "size", "=", "0.1", ")", ":", "stack", "=", "[", "(", "'root'", ",", "0", ",", "self", ".", "root", "[", "'position'", "]", "+", "translate", ")...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
AsfVisitor.create_joints
Traverse the bone hierarchy and create physics joints.
pagoda/parser.py
def create_joints(self): '''Traverse the bone hierarchy and create physics joints.''' stack = ['root'] while stack: parent = stack.pop() for child in self.hierarchy.get(parent, ()): stack.append(child) if parent not in self.bones: ...
def create_joints(self): '''Traverse the bone hierarchy and create physics joints.''' stack = ['root'] while stack: parent = stack.pop() for child in self.hierarchy.get(parent, ()): stack.append(child) if parent not in self.bones: ...
[ "Traverse", "the", "bone", "hierarchy", "and", "create", "physics", "joints", "." ]
EmbodiedCognition/pagoda
python
https://github.com/EmbodiedCognition/pagoda/blob/8892f847026d98aba8646ecbc4589397e6dec7bd/pagoda/parser.py#L468-L483
[ "def", "create_joints", "(", "self", ")", ":", "stack", "=", "[", "'root'", "]", "while", "stack", ":", "parent", "=", "stack", ".", "pop", "(", ")", "for", "child", "in", "self", ".", "hierarchy", ".", "get", "(", "parent", ",", "(", ")", ")", "...
8892f847026d98aba8646ecbc4589397e6dec7bd
valid
format_cookies
将 cookie 字符串转化为字典 :param path: cookies 文件路径 :return: cookies 字典
python_utls/utils/misc.py
def format_cookies(path): """ 将 cookie 字符串转化为字典 :param path: cookies 文件路径 :return: cookies 字典 """ with open(path, 'r') as f: _cookies = {} for row in f.read().split(';'): k, v = row.strip().split('=', 1) _cookies[k] = v return _cookies
def format_cookies(path): """ 将 cookie 字符串转化为字典 :param path: cookies 文件路径 :return: cookies 字典 """ with open(path, 'r') as f: _cookies = {} for row in f.read().split(';'): k, v = row.strip().split('=', 1) _cookies[k] = v return _cookies
[ "将", "cookie", "字符串转化为字典" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/misc.py#L7-L19
[ "def", "format_cookies", "(", "path", ")", ":", "with", "open", "(", "path", ",", "'r'", ")", "as", "f", ":", "_cookies", "=", "{", "}", "for", "row", "in", "f", ".", "read", "(", ")", ".", "split", "(", "';'", ")", ":", "k", ",", "v", "=", ...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
delete_empty_dir
删除空目录 :param directory: 目录路径
python_utls/utils/misc.py
def delete_empty_dir(directory): """ 删除空目录 :param directory: 目录路径 """ if os.path.exists(directory): if os.path.isdir(directory): for d in os.listdir(directory): path = os.path.join(directory, d) if os.path.isdir(path): delete_e...
def delete_empty_dir(directory): """ 删除空目录 :param directory: 目录路径 """ if os.path.exists(directory): if os.path.isdir(directory): for d in os.listdir(directory): path = os.path.join(directory, d) if os.path.isdir(path): delete_e...
[ "删除空目录" ]
chenjiandongx/python-utils
python
https://github.com/chenjiandongx/python-utils/blob/a5cfaaf11c7239122b6613189f32b7e6794b5829/python_utls/utils/misc.py#L22-L39
[ "def", "delete_empty_dir", "(", "directory", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "directory", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "directory", ")", ":", "for", "d", "in", "os", ".", "listdir", "(", "directory", ...
a5cfaaf11c7239122b6613189f32b7e6794b5829
valid
MARCXMLQuery._parse_corporations
Parse informations about corporations from given field identified by `datafield` parameter. Args: datafield (str): MARC field ID ("``110``", "``610``", etc..) subfield (str): MARC subfield ID with name, which is typically stored in "``a``" subfield....
src/marcxml_parser/query.py
def _parse_corporations(self, datafield, subfield, roles=["any"]): """ Parse informations about corporations from given field identified by `datafield` parameter. Args: datafield (str): MARC field ID ("``110``", "``610``", etc..) subfield (str): MARC subfield ID...
def _parse_corporations(self, datafield, subfield, roles=["any"]): """ Parse informations about corporations from given field identified by `datafield` parameter. Args: datafield (str): MARC field ID ("``110``", "``610``", etc..) subfield (str): MARC subfield ID...
[ "Parse", "informations", "about", "corporations", "from", "given", "field", "identified", "by", "datafield", "parameter", "." ]
edeposit/marcxml_parser
python
https://github.com/edeposit/marcxml_parser/blob/6d1c77c61fc2827b71f1b3d5aa3332d7f5807820/src/marcxml_parser/query.py#L40-L93
[ "def", "_parse_corporations", "(", "self", ",", "datafield", ",", "subfield", ",", "roles", "=", "[", "\"any\"", "]", ")", ":", "if", "len", "(", "datafield", ")", "!=", "3", ":", "raise", "ValueError", "(", "\"datafield parameter have to be exactly 3 chars long...
6d1c77c61fc2827b71f1b3d5aa3332d7f5807820