repo
stringlengths
7
54
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
20
28.4k
docstring
stringlengths
1
46.3k
docstring_tokens
listlengths
1
1.66k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
summary
stringlengths
4
350
obf_code
stringlengths
7.85k
764k
milesrichardson/ParsePy
parse_rest/connection.py
ParseBase.execute
def execute(cls, uri, http_verb, extra_headers=None, batch=False, _body=None, **kw): """ if batch == False, execute a command with the given parameters and return the response JSON. If batch == True, return the dictionary that would be used in a batch command. """ ...
python
def execute(cls, uri, http_verb, extra_headers=None, batch=False, _body=None, **kw): """ if batch == False, execute a command with the given parameters and return the response JSON. If batch == True, return the dictionary that would be used in a batch command. """ ...
[ "def", "execute", "(", "cls", ",", "uri", ",", "http_verb", ",", "extra_headers", "=", "None", ",", "batch", "=", "False", ",", "_body", "=", "None", ",", "*", "*", "kw", ")", ":", "if", "batch", ":", "urlsplitter", "=", "urlparse", "(", "API_ROOT", ...
if batch == False, execute a command with the given parameters and return the response JSON. If batch == True, return the dictionary that would be used in a batch command.
[ "if", "batch", "==", "False", "execute", "a", "command", "with", "the", "given", "parameters", "and", "return", "the", "response", "JSON", ".", "If", "batch", "==", "True", "return", "the", "dictionary", "that", "would", "be", "used", "in", "a", "batch", ...
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/connection.py#L85-L150
train
Execute a command with the given parameters and return the response JSON.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/connection.py
ParseBatcher.batch
def batch(self, methods): """ Given a list of create, update or delete methods to call, call all of them in a single batch operation. """ methods = list(methods) # methods can be iterator if not methods: #accepts also empty list (or generator) - it allows call...
python
def batch(self, methods): """ Given a list of create, update or delete methods to call, call all of them in a single batch operation. """ methods = list(methods) # methods can be iterator if not methods: #accepts also empty list (or generator) - it allows call...
[ "def", "batch", "(", "self", ",", "methods", ")", ":", "methods", "=", "list", "(", "methods", ")", "# methods can be iterator", "if", "not", "methods", ":", "#accepts also empty list (or generator) - it allows call batch directly with query result (eventually empty)", "retur...
Given a list of create, update or delete methods to call, call all of them in a single batch operation.
[ "Given", "a", "list", "of", "create", "update", "or", "delete", "methods", "to", "call", "call", "all", "of", "them", "in", "a", "single", "batch", "operation", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/connection.py#L178-L201
train
Calls a list of create update or delete methods in a single batch operation.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/installation.py
Installation.update_channels
def update_channels(cls, installation_id, channels_to_add=set(), channels_to_remove=set(), **kw): """ Allow an application to manually subscribe or unsubscribe an installation to a certain push channel in a unified operation. this is based on: https://www...
python
def update_channels(cls, installation_id, channels_to_add=set(), channels_to_remove=set(), **kw): """ Allow an application to manually subscribe or unsubscribe an installation to a certain push channel in a unified operation. this is based on: https://www...
[ "def", "update_channels", "(", "cls", ",", "installation_id", ",", "channels_to_add", "=", "set", "(", ")", ",", "channels_to_remove", "=", "set", "(", ")", ",", "*", "*", "kw", ")", ":", "installation_url", "=", "cls", ".", "_get_installation_url", "(", "...
Allow an application to manually subscribe or unsubscribe an installation to a certain push channel in a unified operation. this is based on: https://www.parse.com/docs/rest#installations-updating installation_id: the installation id you'd like to add a channel to channels_to_a...
[ "Allow", "an", "application", "to", "manually", "subscribe", "or", "unsubscribe", "an", "installation", "to", "a", "certain", "push", "channel", "in", "a", "unified", "operation", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/installation.py#L30-L49
train
Update the push channels of an anonymization.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/query.py
Queryset._fetch
def _fetch(self, count=False): if self._result_cache is not None: return len(self._result_cache) if count else self._result_cache """ Return a list of objects matching query, or if count == True return only the number of objects matching. """ options = dict(se...
python
def _fetch(self, count=False): if self._result_cache is not None: return len(self._result_cache) if count else self._result_cache """ Return a list of objects matching query, or if count == True return only the number of objects matching. """ options = dict(se...
[ "def", "_fetch", "(", "self", ",", "count", "=", "False", ")", ":", "if", "self", ".", "_result_cache", "is", "not", "None", ":", "return", "len", "(", "self", ".", "_result_cache", ")", "if", "count", "else", "self", ".", "_result_cache", "options", "...
Return a list of objects matching query, or if count == True return only the number of objects matching.
[ "Return", "a", "list", "of", "objects", "matching", "query", "or", "if", "count", "==", "True", "return", "only", "the", "number", "of", "objects", "matching", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/query.py#L111-L128
train
Fetch the objects matching the query.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
complex_type
def complex_type(name=None): '''Decorator for registering complex types''' def wrapped(cls): ParseType.type_mapping[name or cls.__name__] = cls return cls return wrapped
python
def complex_type(name=None): '''Decorator for registering complex types''' def wrapped(cls): ParseType.type_mapping[name or cls.__name__] = cls return cls return wrapped
[ "def", "complex_type", "(", "name", "=", "None", ")", ":", "def", "wrapped", "(", "cls", ")", ":", "ParseType", ".", "type_mapping", "[", "name", "or", "cls", ".", "__name__", "]", "=", "cls", "return", "cls", "return", "wrapped" ]
Decorator for registering complex types
[ "Decorator", "for", "registering", "complex", "types" ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L25-L30
train
Decorator for registering complex types.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
Object.factory
def factory(cls, class_name): """find proper Object subclass matching class_name system types like _User are mapped to types without underscore (parse_resr.user.User) If user don't declare matching type, class is created on the fly """ class_name = str(class_name.lstrip('_')) ...
python
def factory(cls, class_name): """find proper Object subclass matching class_name system types like _User are mapped to types without underscore (parse_resr.user.User) If user don't declare matching type, class is created on the fly """ class_name = str(class_name.lstrip('_')) ...
[ "def", "factory", "(", "cls", ",", "class_name", ")", ":", "class_name", "=", "str", "(", "class_name", ".", "lstrip", "(", "'_'", ")", ")", "types", "=", "ParseResource", ".", "__subclasses__", "(", ")", "while", "types", ":", "t", "=", "types", ".", ...
find proper Object subclass matching class_name system types like _User are mapped to types without underscore (parse_resr.user.User) If user don't declare matching type, class is created on the fly
[ "find", "proper", "Object", "subclass", "matching", "class_name", "system", "types", "like", "_User", "are", "mapped", "to", "types", "without", "underscore", "(", "parse_resr", ".", "user", ".", "User", ")", "If", "user", "don", "t", "declare", "matching", ...
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L545-L558
train
create a proper object subclass matching class_name
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
Object.schema
def schema(cls): """Retrieves the class' schema.""" root = '/'.join([API_ROOT, 'schemas', cls.__name__]) schema = cls.GET(root) return schema
python
def schema(cls): """Retrieves the class' schema.""" root = '/'.join([API_ROOT, 'schemas', cls.__name__]) schema = cls.GET(root) return schema
[ "def", "schema", "(", "cls", ")", ":", "root", "=", "'/'", ".", "join", "(", "[", "API_ROOT", ",", "'schemas'", ",", "cls", ".", "__name__", "]", ")", "schema", "=", "cls", ".", "GET", "(", "root", ")", "return", "schema" ]
Retrieves the class' schema.
[ "Retrieves", "the", "class", "schema", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L568-L572
train
Retrieves the class s schema.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
Object.schema_delete_field
def schema_delete_field(cls, key): """Deletes a field.""" root = '/'.join([API_ROOT, 'schemas', cls.__name__]) payload = { 'className': cls.__name__, 'fields': { key: { '__op': 'Delete' } } } ...
python
def schema_delete_field(cls, key): """Deletes a field.""" root = '/'.join([API_ROOT, 'schemas', cls.__name__]) payload = { 'className': cls.__name__, 'fields': { key: { '__op': 'Delete' } } } ...
[ "def", "schema_delete_field", "(", "cls", ",", "key", ")", ":", "root", "=", "'/'", ".", "join", "(", "[", "API_ROOT", ",", "'schemas'", ",", "cls", ".", "__name__", "]", ")", "payload", "=", "{", "'className'", ":", "cls", ".", "__name__", ",", "'fi...
Deletes a field.
[ "Deletes", "a", "field", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L575-L586
train
Deletes a field.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
Object.increment
def increment(self, key, amount=1): """ Increment one value in the object. Note that this happens immediately: it does not wait for save() to be called """ payload = { key: { '__op': 'Increment', 'amount': amount } ...
python
def increment(self, key, amount=1): """ Increment one value in the object. Note that this happens immediately: it does not wait for save() to be called """ payload = { key: { '__op': 'Increment', 'amount': amount } ...
[ "def", "increment", "(", "self", ",", "key", ",", "amount", "=", "1", ")", ":", "payload", "=", "{", "key", ":", "{", "'__op'", ":", "'Increment'", ",", "'amount'", ":", "amount", "}", "}", "self", ".", "__class__", ".", "PUT", "(", "self", ".", ...
Increment one value in the object. Note that this happens immediately: it does not wait for save() to be called
[ "Increment", "one", "value", "in", "the", "object", ".", "Note", "that", "this", "happens", "immediately", ":", "it", "does", "not", "wait", "for", "save", "()", "to", "be", "called" ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L598-L610
train
Increment one value in the object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/datatypes.py
Object.remove
def remove(self, key): """ Clear a column value in the object. Note that this happens immediately: it does not wait for save() to be called. """ payload = { key: { '__op': 'Delete' } } self.__class__.PUT(self._absolu...
python
def remove(self, key): """ Clear a column value in the object. Note that this happens immediately: it does not wait for save() to be called. """ payload = { key: { '__op': 'Delete' } } self.__class__.PUT(self._absolu...
[ "def", "remove", "(", "self", ",", "key", ")", ":", "payload", "=", "{", "key", ":", "{", "'__op'", ":", "'Delete'", "}", "}", "self", ".", "__class__", ".", "PUT", "(", "self", ".", "_absolute_url", ",", "*", "*", "payload", ")", "del", "self", ...
Clear a column value in the object. Note that this happens immediately: it does not wait for save() to be called.
[ "Clear", "a", "column", "value", "in", "the", "object", ".", "Note", "that", "this", "happens", "immediately", ":", "it", "does", "not", "wait", "for", "save", "()", "to", "be", "called", "." ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/datatypes.py#L612-L623
train
Remove a column value in the object.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/user.py
login_required
def login_required(func): '''decorator describing User methods that need to be logged in''' def ret(obj, *args, **kw): if not hasattr(obj, 'sessionToken'): message = '%s requires a logged-in session' % func.__name__ raise ResourceRequestLoginRequired(message) return func(...
python
def login_required(func): '''decorator describing User methods that need to be logged in''' def ret(obj, *args, **kw): if not hasattr(obj, 'sessionToken'): message = '%s requires a logged-in session' % func.__name__ raise ResourceRequestLoginRequired(message) return func(...
[ "def", "login_required", "(", "func", ")", ":", "def", "ret", "(", "obj", ",", "*", "args", ",", "*", "*", "kw", ")", ":", "if", "not", "hasattr", "(", "obj", ",", "'sessionToken'", ")", ":", "message", "=", "'%s requires a logged-in session'", "%", "f...
decorator describing User methods that need to be logged in
[ "decorator", "describing", "User", "methods", "that", "need", "to", "be", "logged", "in" ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/user.py#L21-L28
train
decorator describing User methods that need to be logged in
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
milesrichardson/ParsePy
parse_rest/user.py
User.request_password_reset
def request_password_reset(email): '''Trigger Parse\'s Password Process. Return True/False indicate success/failure on the request''' url = '/'.join([API_ROOT, 'requestPasswordReset']) try: User.POST(url, email=email) return True except ParseError: ...
python
def request_password_reset(email): '''Trigger Parse\'s Password Process. Return True/False indicate success/failure on the request''' url = '/'.join([API_ROOT, 'requestPasswordReset']) try: User.POST(url, email=email) return True except ParseError: ...
[ "def", "request_password_reset", "(", "email", ")", ":", "url", "=", "'/'", ".", "join", "(", "[", "API_ROOT", ",", "'requestPasswordReset'", "]", ")", "try", ":", "User", ".", "POST", "(", "url", ",", "email", "=", "email", ")", "return", "True", "exc...
Trigger Parse\'s Password Process. Return True/False indicate success/failure on the request
[ "Trigger", "Parse", "\\", "s", "Password", "Process", ".", "Return", "True", "/", "False", "indicate", "success", "/", "failure", "on", "the", "request" ]
7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea
https://github.com/milesrichardson/ParsePy/blob/7c52d8a5dc63bb7c3b0b8c0c09d032b4bc7299ea/parse_rest/user.py#L106-L115
train
Trigger Parse s Password Process. Return True / False indicate success on the request
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/jsonlib.py
parse
def parse(d): """Convert iso formatted timestamps found as values in the dict d to datetime objects. :return: A shallow copy of d with converted timestamps. """ res = {} for k, v in iteritems(d): if isinstance(v, string_types) and DATETIME_ISO_FORMAT.match(v): v = dateutil.parse...
python
def parse(d): """Convert iso formatted timestamps found as values in the dict d to datetime objects. :return: A shallow copy of d with converted timestamps. """ res = {} for k, v in iteritems(d): if isinstance(v, string_types) and DATETIME_ISO_FORMAT.match(v): v = dateutil.parse...
[ "def", "parse", "(", "d", ")", ":", "res", "=", "{", "}", "for", "k", ",", "v", "in", "iteritems", "(", "d", ")", ":", "if", "isinstance", "(", "v", ",", "string_types", ")", "and", "DATETIME_ISO_FORMAT", ".", "match", "(", "v", ")", ":", "v", ...
Convert iso formatted timestamps found as values in the dict d to datetime objects. :return: A shallow copy of d with converted timestamps.
[ "Convert", "iso", "formatted", "timestamps", "found", "as", "values", "in", "the", "dict", "d", "to", "datetime", "objects", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/jsonlib.py#L18-L28
train
Convert iso formatted timestamps found as values in the dict d to datetime objects.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/jsonlib.py
dump
def dump(obj, path, **kw): """Python 2 + 3 compatible version of json.dump. :param obj: The object to be dumped. :param path: The path of the JSON file to be written. :param kw: Keyword parameters are passed to json.dump """ open_kw = {'mode': 'w'} if PY3: # pragma: no cover open_k...
python
def dump(obj, path, **kw): """Python 2 + 3 compatible version of json.dump. :param obj: The object to be dumped. :param path: The path of the JSON file to be written. :param kw: Keyword parameters are passed to json.dump """ open_kw = {'mode': 'w'} if PY3: # pragma: no cover open_k...
[ "def", "dump", "(", "obj", ",", "path", ",", "*", "*", "kw", ")", ":", "open_kw", "=", "{", "'mode'", ":", "'w'", "}", "if", "PY3", ":", "# pragma: no cover", "open_kw", "[", "'encoding'", "]", "=", "'utf-8'", "# avoid indented lines ending with \", \" on PY...
Python 2 + 3 compatible version of json.dump. :param obj: The object to be dumped. :param path: The path of the JSON file to be written. :param kw: Keyword parameters are passed to json.dump
[ "Python", "2", "+", "3", "compatible", "version", "of", "json", ".", "dump", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/jsonlib.py#L37-L53
train
Python 2 + 3 compatible version of json. dump.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/jsonlib.py
load
def load(path, **kw): """python 2 + 3 compatible version of json.load. :param kw: Keyword parameters are passed to json.load :return: The python object read from path. """ _kw = {} if PY3: # pragma: no cover _kw['encoding'] = 'utf-8' with open(str(path), **_kw) as fp: retur...
python
def load(path, **kw): """python 2 + 3 compatible version of json.load. :param kw: Keyword parameters are passed to json.load :return: The python object read from path. """ _kw = {} if PY3: # pragma: no cover _kw['encoding'] = 'utf-8' with open(str(path), **_kw) as fp: retur...
[ "def", "load", "(", "path", ",", "*", "*", "kw", ")", ":", "_kw", "=", "{", "}", "if", "PY3", ":", "# pragma: no cover", "_kw", "[", "'encoding'", "]", "=", "'utf-8'", "with", "open", "(", "str", "(", "path", ")", ",", "*", "*", "_kw", ")", "as...
python 2 + 3 compatible version of json.load. :param kw: Keyword parameters are passed to json.load :return: The python object read from path.
[ "python", "2", "+", "3", "compatible", "version", "of", "json", ".", "load", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/jsonlib.py#L56-L66
train
Python 2 + 3 compatible version of json. load.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/text.py
strip_brackets
def strip_brackets(text, brackets=None): """Strip brackets and what is inside brackets from text. .. note:: If the text contains only one opening bracket, the rest of the text will be ignored. This is a feature, not a bug, as we want to avoid that this function raises errors too easily....
python
def strip_brackets(text, brackets=None): """Strip brackets and what is inside brackets from text. .. note:: If the text contains only one opening bracket, the rest of the text will be ignored. This is a feature, not a bug, as we want to avoid that this function raises errors too easily....
[ "def", "strip_brackets", "(", "text", ",", "brackets", "=", "None", ")", ":", "res", "=", "[", "]", "for", "c", ",", "type_", "in", "_tokens", "(", "text", ",", "brackets", "=", "brackets", ")", ":", "if", "type_", "==", "TextType", ".", "text", ":...
Strip brackets and what is inside brackets from text. .. note:: If the text contains only one opening bracket, the rest of the text will be ignored. This is a feature, not a bug, as we want to avoid that this function raises errors too easily.
[ "Strip", "brackets", "and", "what", "is", "inside", "brackets", "from", "text", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/text.py#L56-L68
train
Strip brackets and what is inside brackets from text.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/text.py
split_text_with_context
def split_text_with_context(text, separators=WHITESPACE, brackets=None): """Splits text at separators outside of brackets. :param text: :param separators: An iterable of single character tokens. :param brackets: :return: A `list` of non-empty chunks. .. note:: This function leaves content in b...
python
def split_text_with_context(text, separators=WHITESPACE, brackets=None): """Splits text at separators outside of brackets. :param text: :param separators: An iterable of single character tokens. :param brackets: :return: A `list` of non-empty chunks. .. note:: This function leaves content in b...
[ "def", "split_text_with_context", "(", "text", ",", "separators", "=", "WHITESPACE", ",", "brackets", "=", "None", ")", ":", "res", ",", "chunk", "=", "[", "]", ",", "[", "]", "for", "c", ",", "type_", "in", "_tokens", "(", "text", ",", "brackets", "...
Splits text at separators outside of brackets. :param text: :param separators: An iterable of single character tokens. :param brackets: :return: A `list` of non-empty chunks. .. note:: This function leaves content in brackets in the chunks.
[ "Splits", "text", "at", "separators", "outside", "of", "brackets", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/text.py#L71-L89
train
Splits text at separators outside of brackets.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/text.py
split_text
def split_text(text, separators=re.compile('\s'), brackets=None, strip=False): """Split text along the separators unless they appear within brackets. :param separators: An iterable single characters or a compiled regex pattern. :param brackets: `dict` mapping start tokens to end tokens of what is to be \ ...
python
def split_text(text, separators=re.compile('\s'), brackets=None, strip=False): """Split text along the separators unless they appear within brackets. :param separators: An iterable single characters or a compiled regex pattern. :param brackets: `dict` mapping start tokens to end tokens of what is to be \ ...
[ "def", "split_text", "(", "text", ",", "separators", "=", "re", ".", "compile", "(", "'\\s'", ")", ",", "brackets", "=", "None", ",", "strip", "=", "False", ")", ":", "if", "not", "isinstance", "(", "separators", ",", "PATTERN_TYPE", ")", ":", "separat...
Split text along the separators unless they appear within brackets. :param separators: An iterable single characters or a compiled regex pattern. :param brackets: `dict` mapping start tokens to end tokens of what is to be \ recognized as brackets. .. note:: This function will also strip content within...
[ "Split", "text", "along", "the", "separators", "unless", "they", "appear", "within", "brackets", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/text.py#L92-L107
train
Split text along the separators unless they appear within brackets.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/sfm.py
marker_split
def marker_split(block): """Yield marker, value pairs from a text block (i.e. a list of lines). :param block: text block consisting of \n separated lines as it will be the case for \ files read using "rU" mode. :return: generator of (marker, value) pairs. """ marker = None value = [] f...
python
def marker_split(block): """Yield marker, value pairs from a text block (i.e. a list of lines). :param block: text block consisting of \n separated lines as it will be the case for \ files read using "rU" mode. :return: generator of (marker, value) pairs. """ marker = None value = [] f...
[ "def", "marker_split", "(", "block", ")", ":", "marker", "=", "None", "value", "=", "[", "]", "for", "line", "in", "block", ".", "split", "(", "'\\n'", ")", ":", "line", "=", "line", ".", "strip", "(", ")", "if", "line", ".", "startswith", "(", "...
Yield marker, value pairs from a text block (i.e. a list of lines). :param block: text block consisting of \n separated lines as it will be the case for \ files read using "rU" mode. :return: generator of (marker, value) pairs.
[ "Yield", "marker", "value", "pairs", "from", "a", "text", "block", "(", "i", ".", "e", ".", "a", "list", "of", "lines", ")", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/sfm.py#L30-L53
train
Yields marker value pairs from a text block.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/sfm.py
Entry.get
def get(self, key, default=None): """Retrieve the first value for a marker or None.""" for k, v in self: if k == key: return v return default
python
def get(self, key, default=None): """Retrieve the first value for a marker or None.""" for k, v in self: if k == key: return v return default
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "for", "k", ",", "v", "in", "self", ":", "if", "k", "==", "key", ":", "return", "v", "return", "default" ]
Retrieve the first value for a marker or None.
[ "Retrieve", "the", "first", "value", "for", "a", "marker", "or", "None", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/sfm.py#L71-L76
train
Retrieve the first value for a marker or None.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/sfm.py
SFM.read
def read(self, filename, encoding='utf-8', marker_map=None, entry_impl=Entry, entry_sep='\n\n', entry_prefix=None, keep_empty=False): """Extend the list by parsing new entries from a file. :param filename: ...
python
def read(self, filename, encoding='utf-8', marker_map=None, entry_impl=Entry, entry_sep='\n\n', entry_prefix=None, keep_empty=False): """Extend the list by parsing new entries from a file. :param filename: ...
[ "def", "read", "(", "self", ",", "filename", ",", "encoding", "=", "'utf-8'", ",", "marker_map", "=", "None", ",", "entry_impl", "=", "Entry", ",", "entry_sep", "=", "'\\n\\n'", ",", "entry_prefix", "=", "None", ",", "keep_empty", "=", "False", ")", ":",...
Extend the list by parsing new entries from a file. :param filename: :param encoding: :param marker_map: A dict used to map marker names. :param entry_impl: Subclass of Entry or None :param entry_sep: :param entry_prefix:
[ "Extend", "the", "list", "by", "parsing", "new", "entries", "from", "a", "file", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/sfm.py#L117-L142
train
Extend the list by parsing new entries from a file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/sfm.py
SFM.write
def write(self, filename, encoding='utf-8'): """Write the list of entries to a file. :param filename: :param encoding: :return: """ with io.open(str(filename), 'w', encoding=encoding) as fp: for entry in self: fp.write(entry.__unicode__()) ...
python
def write(self, filename, encoding='utf-8'): """Write the list of entries to a file. :param filename: :param encoding: :return: """ with io.open(str(filename), 'w', encoding=encoding) as fp: for entry in self: fp.write(entry.__unicode__()) ...
[ "def", "write", "(", "self", ",", "filename", ",", "encoding", "=", "'utf-8'", ")", ":", "with", "io", ".", "open", "(", "str", "(", "filename", ")", ",", "'w'", ",", "encoding", "=", "encoding", ")", "as", "fp", ":", "for", "entry", "in", "self", ...
Write the list of entries to a file. :param filename: :param encoding: :return:
[ "Write", "the", "list", "of", "entries", "to", "a", "file", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/sfm.py#L148-L158
train
Write the list of entries to a file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/clilib.py
confirm
def confirm(question, default=True): """Ask a yes/no question interactively. :param question: The text of the question to ask. :returns: True if the answer was "yes", False otherwise. """ valid = {"": default, "yes": True, "y": True, "no": False, "n": False} while 1: choice = input(ques...
python
def confirm(question, default=True): """Ask a yes/no question interactively. :param question: The text of the question to ask. :returns: True if the answer was "yes", False otherwise. """ valid = {"": default, "yes": True, "y": True, "no": False, "n": False} while 1: choice = input(ques...
[ "def", "confirm", "(", "question", ",", "default", "=", "True", ")", ":", "valid", "=", "{", "\"\"", ":", "default", ",", "\"yes\"", ":", "True", ",", "\"y\"", ":", "True", ",", "\"no\"", ":", "False", ",", "\"n\"", ":", "False", "}", "while", "1",...
Ask a yes/no question interactively. :param question: The text of the question to ask. :returns: True if the answer was "yes", False otherwise.
[ "Ask", "a", "yes", "/", "no", "question", "interactively", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/clilib.py#L113-L124
train
Ask a yes or no question interactively.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/inifile.py
INI.gettext
def gettext(self, section, option, whitespace_preserving_prefix='.'): """ While configparser supports multiline values, it does this at the expense of stripping leading whitespace for each line in such a value. Sometimes we want to preserve such whitespace, e.g. to be able to put markdow...
python
def gettext(self, section, option, whitespace_preserving_prefix='.'): """ While configparser supports multiline values, it does this at the expense of stripping leading whitespace for each line in such a value. Sometimes we want to preserve such whitespace, e.g. to be able to put markdow...
[ "def", "gettext", "(", "self", ",", "section", ",", "option", ",", "whitespace_preserving_prefix", "=", "'.'", ")", ":", "lines", "=", "[", "]", "for", "line", "in", "self", ".", "get", "(", "section", ",", "option", ",", "fallback", "=", "''", ")", ...
While configparser supports multiline values, it does this at the expense of stripping leading whitespace for each line in such a value. Sometimes we want to preserve such whitespace, e.g. to be able to put markdown with nested lists into INI files. We support this be introducing a special prefi...
[ "While", "configparser", "supports", "multiline", "values", "it", "does", "this", "at", "the", "expense", "of", "stripping", "leading", "whitespace", "for", "each", "line", "in", "such", "a", "value", ".", "Sometimes", "we", "want", "to", "preserve", "such", ...
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/inifile.py#L44-L58
train
Return the gettext string for the specified option in section.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
data_url
def data_url(content, mimetype=None): """ Returns content encoded as base64 Data URI. :param content: bytes or str or Path :param mimetype: mimetype for :return: str object (consisting only of ASCII, though) .. seealso:: https://en.wikipedia.org/wiki/Data_URI_scheme """ if isinstance(c...
python
def data_url(content, mimetype=None): """ Returns content encoded as base64 Data URI. :param content: bytes or str or Path :param mimetype: mimetype for :return: str object (consisting only of ASCII, though) .. seealso:: https://en.wikipedia.org/wiki/Data_URI_scheme """ if isinstance(c...
[ "def", "data_url", "(", "content", ",", "mimetype", "=", "None", ")", ":", "if", "isinstance", "(", "content", ",", "pathlib", ".", "Path", ")", ":", "if", "not", "mimetype", ":", "mimetype", "=", "guess_type", "(", "content", ".", "name", ")", "[", ...
Returns content encoded as base64 Data URI. :param content: bytes or str or Path :param mimetype: mimetype for :return: str object (consisting only of ASCII, though) .. seealso:: https://en.wikipedia.org/wiki/Data_URI_scheme
[ "Returns", "content", "encoded", "as", "base64", "Data", "URI", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L24-L43
train
Returns content encoded as base64 Data URI.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
to_binary
def to_binary(s, encoding='utf8'): """Portable cast function. In python 2 the ``str`` function which is used to coerce objects to bytes does not accept an encoding argument, whereas python 3's ``bytes`` function requires one. :param s: object to be converted to binary_type :return: binary_type ins...
python
def to_binary(s, encoding='utf8'): """Portable cast function. In python 2 the ``str`` function which is used to coerce objects to bytes does not accept an encoding argument, whereas python 3's ``bytes`` function requires one. :param s: object to be converted to binary_type :return: binary_type ins...
[ "def", "to_binary", "(", "s", ",", "encoding", "=", "'utf8'", ")", ":", "if", "PY3", ":", "# pragma: no cover", "return", "s", "if", "isinstance", "(", "s", ",", "binary_type", ")", "else", "binary_type", "(", "s", ",", "encoding", "=", "encoding", ")", ...
Portable cast function. In python 2 the ``str`` function which is used to coerce objects to bytes does not accept an encoding argument, whereas python 3's ``bytes`` function requires one. :param s: object to be converted to binary_type :return: binary_type instance, representing s.
[ "Portable", "cast", "function", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L61-L72
train
Portable cast function.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
dict_merged
def dict_merged(d, _filter=None, **kw): """Update dictionary d with the items passed as kw if the value passes _filter.""" def f(s): if _filter: return _filter(s) return s is not None d = d or {} for k, v in iteritems(kw): if f(v): d[k] = v return d
python
def dict_merged(d, _filter=None, **kw): """Update dictionary d with the items passed as kw if the value passes _filter.""" def f(s): if _filter: return _filter(s) return s is not None d = d or {} for k, v in iteritems(kw): if f(v): d[k] = v return d
[ "def", "dict_merged", "(", "d", ",", "_filter", "=", "None", ",", "*", "*", "kw", ")", ":", "def", "f", "(", "s", ")", ":", "if", "_filter", ":", "return", "_filter", "(", "s", ")", "return", "s", "is", "not", "None", "d", "=", "d", "or", "{"...
Update dictionary d with the items passed as kw if the value passes _filter.
[ "Update", "dictionary", "d", "with", "the", "items", "passed", "as", "kw", "if", "the", "value", "passes", "_filter", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L75-L85
train
Update dictionary d with the items passed as kw if the value passes _filter.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
xmlchars
def xmlchars(text): """Not all of UTF-8 is considered valid character data in XML ... Thus, this function can be used to remove illegal characters from ``text``. """ invalid = list(range(0x9)) invalid.extend([0xb, 0xc]) invalid.extend(range(0xe, 0x20)) return re.sub('|'.join('\\x%0.2X' % i ...
python
def xmlchars(text): """Not all of UTF-8 is considered valid character data in XML ... Thus, this function can be used to remove illegal characters from ``text``. """ invalid = list(range(0x9)) invalid.extend([0xb, 0xc]) invalid.extend(range(0xe, 0x20)) return re.sub('|'.join('\\x%0.2X' % i ...
[ "def", "xmlchars", "(", "text", ")", ":", "invalid", "=", "list", "(", "range", "(", "0x9", ")", ")", "invalid", ".", "extend", "(", "[", "0xb", ",", "0xc", "]", ")", "invalid", ".", "extend", "(", "range", "(", "0xe", ",", "0x20", ")", ")", "r...
Not all of UTF-8 is considered valid character data in XML ... Thus, this function can be used to remove illegal characters from ``text``.
[ "Not", "all", "of", "UTF", "-", "8", "is", "considered", "valid", "character", "data", "in", "XML", "..." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L99-L107
train
Remove illegal characters from text.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
slug
def slug(s, remove_whitespace=True, lowercase=True): """Condensed version of s, containing only lowercase alphanumeric characters.""" res = ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn') if lowercase: res = res.lower() for c in string.pun...
python
def slug(s, remove_whitespace=True, lowercase=True): """Condensed version of s, containing only lowercase alphanumeric characters.""" res = ''.join(c for c in unicodedata.normalize('NFD', s) if unicodedata.category(c) != 'Mn') if lowercase: res = res.lower() for c in string.pun...
[ "def", "slug", "(", "s", ",", "remove_whitespace", "=", "True", ",", "lowercase", "=", "True", ")", ":", "res", "=", "''", ".", "join", "(", "c", "for", "c", "in", "unicodedata", ".", "normalize", "(", "'NFD'", ",", "s", ")", "if", "unicodedata", "...
Condensed version of s, containing only lowercase alphanumeric characters.
[ "Condensed", "version", "of", "s", "containing", "only", "lowercase", "alphanumeric", "characters", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L139-L150
train
Condensed version of s containing only lowercase alphanumeric characters.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/misc.py
encoded
def encoded(string, encoding='utf-8'): """Cast string to binary_type. :param string: six.binary_type or six.text_type :param encoding: encoding which the object is forced to :return: six.binary_type """ assert isinstance(string, string_types) or isinstance(string, binary_type) if isinstance...
python
def encoded(string, encoding='utf-8'): """Cast string to binary_type. :param string: six.binary_type or six.text_type :param encoding: encoding which the object is forced to :return: six.binary_type """ assert isinstance(string, string_types) or isinstance(string, binary_type) if isinstance...
[ "def", "encoded", "(", "string", ",", "encoding", "=", "'utf-8'", ")", ":", "assert", "isinstance", "(", "string", ",", "string_types", ")", "or", "isinstance", "(", "string", ",", "binary_type", ")", "if", "isinstance", "(", "string", ",", "text_type", ")...
Cast string to binary_type. :param string: six.binary_type or six.text_type :param encoding: encoding which the object is forced to :return: six.binary_type
[ "Cast", "string", "to", "binary_type", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/misc.py#L153-L170
train
Cast string to binary_type.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/path.py
readlines
def readlines(p, encoding=None, strip=False, comment=None, normalize=None, linenumbers=False): """ Read a `list` of lines from a text file. :param p: File path (or `list` or `tuple` of text) :param encoding: Registered codec. :pa...
python
def readlines(p, encoding=None, strip=False, comment=None, normalize=None, linenumbers=False): """ Read a `list` of lines from a text file. :param p: File path (or `list` or `tuple` of text) :param encoding: Registered codec. :pa...
[ "def", "readlines", "(", "p", ",", "encoding", "=", "None", ",", "strip", "=", "False", ",", "comment", "=", "None", ",", "normalize", "=", "None", ",", "linenumbers", "=", "False", ")", ":", "if", "comment", ":", "strip", "=", "True", "if", "isinsta...
Read a `list` of lines from a text file. :param p: File path (or `list` or `tuple` of text) :param encoding: Registered codec. :param strip: If `True`, strip leading and trailing whitespace. :param comment: String used as syntax to mark comment lines. When not `None`, \ commented lines will be stri...
[ "Read", "a", "list", "of", "lines", "from", "a", "text", "file", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/path.py#L96-L129
train
Read a list of lines from a text file.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/path.py
walk
def walk(p, mode='all', **kw): """Wrapper for `os.walk`, yielding `Path` objects. :param p: root of the directory tree to walk. :param mode: 'all|dirs|files', defaulting to 'all'. :param kw: Keyword arguments are passed to `os.walk`. :return: Generator for the requested Path objects. """ fo...
python
def walk(p, mode='all', **kw): """Wrapper for `os.walk`, yielding `Path` objects. :param p: root of the directory tree to walk. :param mode: 'all|dirs|files', defaulting to 'all'. :param kw: Keyword arguments are passed to `os.walk`. :return: Generator for the requested Path objects. """ fo...
[ "def", "walk", "(", "p", ",", "mode", "=", "'all'", ",", "*", "*", "kw", ")", ":", "for", "dirpath", ",", "dirnames", ",", "filenames", "in", "os", ".", "walk", "(", "as_posix", "(", "p", ")", ",", "*", "*", "kw", ")", ":", "if", "mode", "in"...
Wrapper for `os.walk`, yielding `Path` objects. :param p: root of the directory tree to walk. :param mode: 'all|dirs|files', defaulting to 'all'. :param kw: Keyword arguments are passed to `os.walk`. :return: Generator for the requested Path objects.
[ "Wrapper", "for", "os", ".", "walk", "yielding", "Path", "objects", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/path.py#L148-L162
train
Wrapper for os. walk yielding Path objects.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/source.py
Source.bibtex
def bibtex(self): """Represent the source in BibTeX format. :return: string encoding the source in BibTeX syntax. """ m = max(itertools.chain(map(len, self), [0])) fields = (" %s = {%s}" % (k.ljust(m), self[k]) for k in self) return "@%s{%s,\n%s\n}" % ( geta...
python
def bibtex(self): """Represent the source in BibTeX format. :return: string encoding the source in BibTeX syntax. """ m = max(itertools.chain(map(len, self), [0])) fields = (" %s = {%s}" % (k.ljust(m), self[k]) for k in self) return "@%s{%s,\n%s\n}" % ( geta...
[ "def", "bibtex", "(", "self", ")", ":", "m", "=", "max", "(", "itertools", ".", "chain", "(", "map", "(", "len", ",", "self", ")", ",", "[", "0", "]", ")", ")", "fields", "=", "(", "\" %s = {%s}\"", "%", "(", "k", ".", "ljust", "(", "m", ")"...
Represent the source in BibTeX format. :return: string encoding the source in BibTeX syntax.
[ "Represent", "the", "source", "in", "BibTeX", "format", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/source.py#L109-L117
train
Represent the source in BibTeX format.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
clld/clldutils
src/clldutils/source.py
Source.text
def text(self): """Linearize the bib source according to the rules of the unified style. Book: author. year. booktitle. (series, volume.) address: publisher. Article: author. year. title. journal volume(issue). pages. Incollection: author. year. title. In edito...
python
def text(self): """Linearize the bib source according to the rules of the unified style. Book: author. year. booktitle. (series, volume.) address: publisher. Article: author. year. title. journal volume(issue). pages. Incollection: author. year. title. In edito...
[ "def", "text", "(", "self", ")", ":", "genre", "=", "getattr", "(", "self", ".", "genre", ",", "'value'", ",", "self", ".", "genre", ")", "pages_at_end", "=", "genre", "in", "(", "'book'", ",", "'phdthesis'", ",", "'mastersthesis'", ",", "'misc'", ",",...
Linearize the bib source according to the rules of the unified style. Book: author. year. booktitle. (series, volume.) address: publisher. Article: author. year. title. journal volume(issue). pages. Incollection: author. year. title. In editor (ed.), booktitle, pages. ...
[ "Linearize", "the", "bib", "source", "according", "to", "the", "rules", "of", "the", "unified", "style", "." ]
7b8587ef5b56a2fc6cafaff90bc5004355c2b13f
https://github.com/clld/clldutils/blob/7b8587ef5b56a2fc6cafaff90bc5004355c2b13f/src/clldutils/source.py#L131-L235
train
Linearize the bib source according to the rules of the unified style.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.request
def request(self, path, method='GET', params=None, type=REST_TYPE): """Builds a request, gets a response and decodes it.""" response_text = self._get_http_client(type).request(path, method, params) if not response_text: return response_text response_json = json.loads(respon...
python
def request(self, path, method='GET', params=None, type=REST_TYPE): """Builds a request, gets a response and decodes it.""" response_text = self._get_http_client(type).request(path, method, params) if not response_text: return response_text response_json = json.loads(respon...
[ "def", "request", "(", "self", ",", "path", ",", "method", "=", "'GET'", ",", "params", "=", "None", ",", "type", "=", "REST_TYPE", ")", ":", "response_text", "=", "self", ".", "_get_http_client", "(", "type", ")", ".", "request", "(", "path", ",", "...
Builds a request, gets a response and decodes it.
[ "Builds", "a", "request", "gets", "a", "response", "and", "decodes", "it", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L52-L64
train
Builds a request gets a response and decodes it.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.hlr_create
def hlr_create(self, msisdn, reference): """Perform a new HLR lookup.""" return HLR().load(self.request('hlr', 'POST', {'msisdn': msisdn, 'reference': reference}))
python
def hlr_create(self, msisdn, reference): """Perform a new HLR lookup.""" return HLR().load(self.request('hlr', 'POST', {'msisdn': msisdn, 'reference': reference}))
[ "def", "hlr_create", "(", "self", ",", "msisdn", ",", "reference", ")", ":", "return", "HLR", "(", ")", ".", "load", "(", "self", ".", "request", "(", "'hlr'", ",", "'POST'", ",", "{", "'msisdn'", ":", "msisdn", ",", "'reference'", ":", "reference", ...
Perform a new HLR lookup.
[ "Perform", "a", "new", "HLR", "lookup", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L92-L94
train
Perform a new HLR lookup.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.message_create
def message_create(self, originator, recipients, body, params=None): """Create a new message.""" if params is None: params = {} if type(recipients) == list: recipients = ','.join(recipients) params.update({'originator': originator, 'body': body, 'recipients': recipients}) ...
python
def message_create(self, originator, recipients, body, params=None): """Create a new message.""" if params is None: params = {} if type(recipients) == list: recipients = ','.join(recipients) params.update({'originator': originator, 'body': body, 'recipients': recipients}) ...
[ "def", "message_create", "(", "self", ",", "originator", ",", "recipients", ",", "body", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "if", "type", "(", "recipients", ")", "==", "list", ":", "recip...
Create a new message.
[ "Create", "a", "new", "message", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L100-L107
train
Create a new message.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.voice_message_create
def voice_message_create(self, recipients, body, params=None): """Create a new voice message.""" if params is None: params = {} if type(recipients) == list: recipients = ','.join(recipients) params.update({'recipients': recipients, 'body': body}) return VoiceMessage(...
python
def voice_message_create(self, recipients, body, params=None): """Create a new voice message.""" if params is None: params = {} if type(recipients) == list: recipients = ','.join(recipients) params.update({'recipients': recipients, 'body': body}) return VoiceMessage(...
[ "def", "voice_message_create", "(", "self", ",", "recipients", ",", "body", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "if", "type", "(", "recipients", ")", "==", "list", ":", "recipients", "=", ...
Create a new voice message.
[ "Create", "a", "new", "voice", "message", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L117-L124
train
Create a new voice message.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.lookup
def lookup(self, phonenumber, params=None): """Do a new lookup.""" if params is None: params = {} return Lookup().load(self.request('lookup/' + str(phonenumber), 'GET', params))
python
def lookup(self, phonenumber, params=None): """Do a new lookup.""" if params is None: params = {} return Lookup().load(self.request('lookup/' + str(phonenumber), 'GET', params))
[ "def", "lookup", "(", "self", ",", "phonenumber", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "return", "Lookup", "(", ")", ".", "load", "(", "self", ".", "request", "(", "'lookup/'", "+", "str"...
Do a new lookup.
[ "Do", "a", "new", "lookup", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L126-L129
train
Do a new lookup.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.lookup_hlr
def lookup_hlr(self, phonenumber, params=None): """Retrieve the information of a specific HLR lookup.""" if params is None: params = {} return HLR().load(self.request('lookup/' + str(phonenumber) + '/hlr', 'GET', params))
python
def lookup_hlr(self, phonenumber, params=None): """Retrieve the information of a specific HLR lookup.""" if params is None: params = {} return HLR().load(self.request('lookup/' + str(phonenumber) + '/hlr', 'GET', params))
[ "def", "lookup_hlr", "(", "self", ",", "phonenumber", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "return", "HLR", "(", ")", ".", "load", "(", "self", ".", "request", "(", "'lookup/'", "+", "str...
Retrieve the information of a specific HLR lookup.
[ "Retrieve", "the", "information", "of", "a", "specific", "HLR", "lookup", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L131-L134
train
Retrieve the information of a specific HLR lookup.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.lookup_hlr_create
def lookup_hlr_create(self, phonenumber, params=None): """Perform a new HLR lookup.""" if params is None: params = {} return HLR().load(self.request('lookup/' + str(phonenumber) + '/hlr', 'POST', params))
python
def lookup_hlr_create(self, phonenumber, params=None): """Perform a new HLR lookup.""" if params is None: params = {} return HLR().load(self.request('lookup/' + str(phonenumber) + '/hlr', 'POST', params))
[ "def", "lookup_hlr_create", "(", "self", ",", "phonenumber", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "return", "HLR", "(", ")", ".", "load", "(", "self", ".", "request", "(", "'lookup/'", "+",...
Perform a new HLR lookup.
[ "Perform", "a", "new", "HLR", "lookup", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L136-L139
train
Perform a new HLR lookup.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.verify_create
def verify_create(self, recipient, params=None): """Create a new verification.""" if params is None: params = {} params.update({'recipient': recipient}) return Verify().load(self.request('verify', 'POST', params))
python
def verify_create(self, recipient, params=None): """Create a new verification.""" if params is None: params = {} params.update({'recipient': recipient}) return Verify().load(self.request('verify', 'POST', params))
[ "def", "verify_create", "(", "self", ",", "recipient", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "params", ".", "update", "(", "{", "'recipient'", ":", "recipient", "}", ")", "return", "Verify", ...
Create a new verification.
[ "Create", "a", "new", "verification", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L145-L149
train
Create a new verification.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/client.py
Client.verify_verify
def verify_verify(self, id, token): """Verify the token of a specific verification.""" return Verify().load(self.request('verify/' + str(id), params={'token': token}))
python
def verify_verify(self, id, token): """Verify the token of a specific verification.""" return Verify().load(self.request('verify/' + str(id), params={'token': token}))
[ "def", "verify_verify", "(", "self", ",", "id", ",", "token", ")", ":", "return", "Verify", "(", ")", ".", "load", "(", "self", ".", "request", "(", "'verify/'", "+", "str", "(", "id", ")", ",", "params", "=", "{", "'token'", ":", "token", "}", "...
Verify the token of a specific verification.
[ "Verify", "the", "token", "of", "a", "specific", "verification", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/client.py#L151-L153
train
Verify the token of a specific verification.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/base_list.py
BaseList.items
def items(self, value): """Create typed objects from the dicts.""" items = [] for item in value: items.append(self.itemType().load(item)) self._items = items
python
def items(self, value): """Create typed objects from the dicts.""" items = [] for item in value: items.append(self.itemType().load(item)) self._items = items
[ "def", "items", "(", "self", ",", "value", ")", ":", "items", "=", "[", "]", "for", "item", "in", "value", ":", "items", ".", "append", "(", "self", ".", "itemType", "(", ")", ".", "load", "(", "item", ")", ")", "self", ".", "_items", "=", "ite...
Create typed objects from the dicts.
[ "Create", "typed", "objects", "from", "the", "dicts", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/base_list.py#L39-L45
train
Create typed objects from the dicts.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
messagebird/python-rest-api
messagebird/http_client.py
HttpClient.request
def request(self, path, method='GET', params=None): """Builds a request and gets a response.""" if params is None: params = {} url = urljoin(self.endpoint, path) headers = { 'Accept': 'application/json', 'Authorization': 'AccessKey ' + self.access_key, ...
python
def request(self, path, method='GET', params=None): """Builds a request and gets a response.""" if params is None: params = {} url = urljoin(self.endpoint, path) headers = { 'Accept': 'application/json', 'Authorization': 'AccessKey ' + self.access_key, ...
[ "def", "request", "(", "self", ",", "path", ",", "method", "=", "'GET'", ",", "params", "=", "None", ")", ":", "if", "params", "is", "None", ":", "params", "=", "{", "}", "url", "=", "urljoin", "(", "self", ".", "endpoint", ",", "path", ")", "hea...
Builds a request and gets a response.
[ "Builds", "a", "request", "and", "gets", "a", "response", "." ]
fb7864f178135f92d09af803bee93270e99f3963
https://github.com/messagebird/python-rest-api/blob/fb7864f178135f92d09af803bee93270e99f3963/messagebird/http_client.py#L20-L50
train
Builds a request and gets a response.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
sagemath/cysignals
setup.py
build.run
def run(self): """ Run ``./configure`` and Cython first. """ config_h = opj("src", "cysignals", "cysignals_config.h") if not os.path.isfile(config_h): import subprocess subprocess.check_call(["make", "configure"]) subprocess.check_call(["sh", "...
python
def run(self): """ Run ``./configure`` and Cython first. """ config_h = opj("src", "cysignals", "cysignals_config.h") if not os.path.isfile(config_h): import subprocess subprocess.check_call(["make", "configure"]) subprocess.check_call(["sh", "...
[ "def", "run", "(", "self", ")", ":", "config_h", "=", "opj", "(", "\"src\"", ",", "\"cysignals\"", ",", "\"cysignals_config.h\"", ")", "if", "not", "os", ".", "path", ".", "isfile", "(", "config_h", ")", ":", "import", "subprocess", "subprocess", ".", "c...
Run ``./configure`` and Cython first.
[ "Run", ".", "/", "configure", "and", "Cython", "first", "." ]
a8a8ad789332996e7e094188d65884982e899a65
https://github.com/sagemath/cysignals/blob/a8a8ad789332996e7e094188d65884982e899a65/setup.py#L88-L103
train
Run Cython first.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
sagemath/cysignals
src/scripts/cysignals-CSI-helper.py
cython_debug_files
def cython_debug_files(): """ Cython extra debug information files """ # Search all subdirectories of sys.path directories for a # "cython_debug" directory. Note that sys_path is a variable set by # cysignals-CSI. It may differ from sys.path if GDB is run with a # different Python interprete...
python
def cython_debug_files(): """ Cython extra debug information files """ # Search all subdirectories of sys.path directories for a # "cython_debug" directory. Note that sys_path is a variable set by # cysignals-CSI. It may differ from sys.path if GDB is run with a # different Python interprete...
[ "def", "cython_debug_files", "(", ")", ":", "# Search all subdirectories of sys.path directories for a", "# \"cython_debug\" directory. Note that sys_path is a variable set by", "# cysignals-CSI. It may differ from sys.path if GDB is run with a", "# different Python interpreter.", "files", "=", ...
Cython extra debug information files
[ "Cython", "extra", "debug", "information", "files" ]
a8a8ad789332996e7e094188d65884982e899a65
https://github.com/sagemath/cysignals/blob/a8a8ad789332996e7e094188d65884982e899a65/src/scripts/cysignals-CSI-helper.py#L34-L46
train
Returns a list of all cython extra debug information files.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/colorized_phoxi_sensor.py
ColorizedPhoXiSensor.start
def start(self): """Start the sensor. """ running = self._webcam.start() if not running: return running running &= self._phoxi.start() if not running: self._webcam.stop() return running
python
def start(self): """Start the sensor. """ running = self._webcam.start() if not running: return running running &= self._phoxi.start() if not running: self._webcam.stop() return running
[ "def", "start", "(", "self", ")", ":", "running", "=", "self", ".", "_webcam", ".", "start", "(", ")", "if", "not", "running", ":", "return", "running", "running", "&=", "self", ".", "_phoxi", ".", "start", "(", ")", "if", "not", "running", ":", "s...
Start the sensor.
[ "Start", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/colorized_phoxi_sensor.py#L81-L91
train
Start the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/colorized_phoxi_sensor.py
ColorizedPhoXiSensor.stop
def stop(self): """Stop the sensor. """ # Check that everything is running if not self._running: logging.warning('Colorized PhoXi not running. Aborting stop') return False self._webcam.stop() self._phoxi.stop() return True
python
def stop(self): """Stop the sensor. """ # Check that everything is running if not self._running: logging.warning('Colorized PhoXi not running. Aborting stop') return False self._webcam.stop() self._phoxi.stop() return True
[ "def", "stop", "(", "self", ")", ":", "# Check that everything is running", "if", "not", "self", ".", "_running", ":", "logging", ".", "warning", "(", "'Colorized PhoXi not running. Aborting stop'", ")", "return", "False", "self", ".", "_webcam", ".", "stop", "(",...
Stop the sensor.
[ "Stop", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/colorized_phoxi_sensor.py#L93-L104
train
Stop the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/colorized_phoxi_sensor.py
ColorizedPhoXiSensor.frames
def frames(self): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage o...
python
def frames(self): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage o...
[ "def", "frames", "(", "self", ")", ":", "_", ",", "phoxi_depth_im", ",", "_", "=", "self", ".", "_phoxi", ".", "frames", "(", ")", "webcam_color_im", ",", "_", ",", "_", "=", "self", ".", "_webcam", ".", "frames", "(", "most_recent", "=", "True", "...
Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage of the current frame.
[ "Retrieve", "a", "new", "frame", "from", "the", "PhoXi", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/colorized_phoxi_sensor.py#L106-L120
train
Retrieve a new frame from the PhoXi and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/colorized_phoxi_sensor.py
ColorizedPhoXiSensor.median_depth_img
def median_depth_img(self, num_img=1, fill_depth=0.0): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- DepthImage The m...
python
def median_depth_img(self, num_img=1, fill_depth=0.0): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- DepthImage The m...
[ "def", "median_depth_img", "(", "self", ",", "num_img", "=", "1", ",", "fill_depth", "=", "0.0", ")", ":", "depths", "=", "[", "]", "for", "_", "in", "range", "(", "num_img", ")", ":", "_", ",", "depth", ",", "_", "=", "self", ".", "frames", "(",...
Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- DepthImage The median DepthImage collected from the frames.
[ "Collect", "a", "series", "of", "depth", "images", "and", "return", "the", "median", "of", "the", "set", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/colorized_phoxi_sensor.py#L122-L143
train
Collect a series of depth images and return the median of the set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/colorized_phoxi_sensor.py
ColorizedPhoXiSensor._colorize
def _colorize(self, depth_im, color_im): """Colorize a depth image from the PhoXi using a color image from the webcam. Parameters ---------- depth_im : DepthImage The PhoXi depth image. color_im : ColorImage Corresponding color image. Returns ...
python
def _colorize(self, depth_im, color_im): """Colorize a depth image from the PhoXi using a color image from the webcam. Parameters ---------- depth_im : DepthImage The PhoXi depth image. color_im : ColorImage Corresponding color image. Returns ...
[ "def", "_colorize", "(", "self", ",", "depth_im", ",", "color_im", ")", ":", "# Project the point cloud into the webcam's frame", "target_shape", "=", "(", "depth_im", ".", "data", ".", "shape", "[", "0", "]", ",", "depth_im", ".", "data", ".", "shape", "[", ...
Colorize a depth image from the PhoXi using a color image from the webcam. Parameters ---------- depth_im : DepthImage The PhoXi depth image. color_im : ColorImage Corresponding color image. Returns ------- ColorImage A colori...
[ "Colorize", "a", "depth", "image", "from", "the", "PhoXi", "using", "a", "color", "image", "from", "the", "webcam", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/colorized_phoxi_sensor.py#L145-L196
train
Colorize a depth image from the PhoXi using a color image from the webcam.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/rgbd_sensors.py
RgbdSensorFactory.sensor
def sensor(sensor_type, cfg): """ Creates a camera sensor of the specified type. Parameters ---------- sensor_type : :obj:`str` the type of the sensor (real or virtual) cfg : :obj:`YamlConfig` dictionary of parameters for sensor initialization """...
python
def sensor(sensor_type, cfg): """ Creates a camera sensor of the specified type. Parameters ---------- sensor_type : :obj:`str` the type of the sensor (real or virtual) cfg : :obj:`YamlConfig` dictionary of parameters for sensor initialization """...
[ "def", "sensor", "(", "sensor_type", ",", "cfg", ")", ":", "sensor_type", "=", "sensor_type", ".", "lower", "(", ")", "if", "sensor_type", "==", "'kinect2'", ":", "s", "=", "Kinect2Sensor", "(", "packet_pipeline_mode", "=", "cfg", "[", "'pipeline_mode'", "]"...
Creates a camera sensor of the specified type. Parameters ---------- sensor_type : :obj:`str` the type of the sensor (real or virtual) cfg : :obj:`YamlConfig` dictionary of parameters for sensor initialization
[ "Creates", "a", "camera", "sensor", "of", "the", "specified", "type", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/rgbd_sensors.py#L11-L63
train
Creates a new sensor object of the specified type.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/feature_matcher.py
FeatureMatcher.get_point_index
def get_point_index(point, all_points, eps = 1e-4): """ Get the index of a point in an array """ inds = np.where(np.linalg.norm(point - all_points, axis=1) < eps) if inds[0].shape[0] == 0: return -1 return inds[0][0]
python
def get_point_index(point, all_points, eps = 1e-4): """ Get the index of a point in an array """ inds = np.where(np.linalg.norm(point - all_points, axis=1) < eps) if inds[0].shape[0] == 0: return -1 return inds[0][0]
[ "def", "get_point_index", "(", "point", ",", "all_points", ",", "eps", "=", "1e-4", ")", ":", "inds", "=", "np", ".", "where", "(", "np", ".", "linalg", ".", "norm", "(", "point", "-", "all_points", ",", "axis", "=", "1", ")", "<", "eps", ")", "i...
Get the index of a point in an array
[ "Get", "the", "index", "of", "a", "point", "in", "an", "array" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/feature_matcher.py#L111-L116
train
Get the index of a point in an array
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/feature_matcher.py
RawDistanceFeatureMatcher.match
def match(self, source_obj_features, target_obj_features): """ Matches features between two graspable objects based on a full distance matrix. Parameters ---------- source_obj_features : :obj:`BagOfFeatures` bag of the source objects features target_obj_featu...
python
def match(self, source_obj_features, target_obj_features): """ Matches features between two graspable objects based on a full distance matrix. Parameters ---------- source_obj_features : :obj:`BagOfFeatures` bag of the source objects features target_obj_featu...
[ "def", "match", "(", "self", ",", "source_obj_features", ",", "target_obj_features", ")", ":", "if", "not", "isinstance", "(", "source_obj_features", ",", "f", ".", "BagOfFeatures", ")", ":", "raise", "ValueError", "(", "'Must supply source bag of object features'", ...
Matches features between two graspable objects based on a full distance matrix. Parameters ---------- source_obj_features : :obj:`BagOfFeatures` bag of the source objects features target_obj_features : :obj:`BagOfFeatures` bag of the target objects features ...
[ "Matches", "features", "between", "two", "graspable", "objects", "based", "on", "a", "full", "distance", "matrix", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/feature_matcher.py#L126-L173
train
Matches features between two graspable objects based on a full distance matrix.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/feature_matcher.py
PointToPlaneFeatureMatcher.match
def match(self, source_points, target_points, source_normals, target_normals): """ Matches points between two point-normal sets. Uses the closest ip to choose matches, with distance for thresholding only. Parameters ---------- source_point_cloud : Nx3 :obj:`numpy.ndarray` ...
python
def match(self, source_points, target_points, source_normals, target_normals): """ Matches points between two point-normal sets. Uses the closest ip to choose matches, with distance for thresholding only. Parameters ---------- source_point_cloud : Nx3 :obj:`numpy.ndarray` ...
[ "def", "match", "(", "self", ",", "source_points", ",", "target_points", ",", "source_normals", ",", "target_normals", ")", ":", "# compute the distances and inner products between the point sets", "dists", "=", "ssd", ".", "cdist", "(", "source_points", ",", "target_po...
Matches points between two point-normal sets. Uses the closest ip to choose matches, with distance for thresholding only. Parameters ---------- source_point_cloud : Nx3 :obj:`numpy.ndarray` source object points target_point_cloud : Nx3 :obj:`numpy.ndarray` target...
[ "Matches", "points", "between", "two", "point", "-", "normal", "sets", ".", "Uses", "the", "closest", "ip", "to", "choose", "matches", "with", "distance", "for", "thresholding", "only", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/feature_matcher.py#L190-L231
train
Matches points between two point - normal sets. Uses the closest ip to choose matches with thresholding only.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor._config_pipe
def _config_pipe(self): """Configures the pipeline to stream color and depth. """ self._cfg.enable_device(self.id) # configure the color stream self._cfg.enable_stream( rs.stream.color, RealSenseSensor.COLOR_IM_WIDTH, RealSenseSensor.COLOR_IM_...
python
def _config_pipe(self): """Configures the pipeline to stream color and depth. """ self._cfg.enable_device(self.id) # configure the color stream self._cfg.enable_stream( rs.stream.color, RealSenseSensor.COLOR_IM_WIDTH, RealSenseSensor.COLOR_IM_...
[ "def", "_config_pipe", "(", "self", ")", ":", "self", ".", "_cfg", ".", "enable_device", "(", "self", ".", "id", ")", "# configure the color stream", "self", ".", "_cfg", ".", "enable_stream", "(", "rs", ".", "stream", ".", "color", ",", "RealSenseSensor", ...
Configures the pipeline to stream color and depth.
[ "Configures", "the", "pipeline", "to", "stream", "color", "and", "depth", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L79-L100
train
Configures the pipeline to stream color and depth.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor._set_depth_scale
def _set_depth_scale(self): """Retrieve the scale of the depth sensor. """ sensor = self._profile.get_device().first_depth_sensor() self._depth_scale = sensor.get_depth_scale()
python
def _set_depth_scale(self): """Retrieve the scale of the depth sensor. """ sensor = self._profile.get_device().first_depth_sensor() self._depth_scale = sensor.get_depth_scale()
[ "def", "_set_depth_scale", "(", "self", ")", ":", "sensor", "=", "self", ".", "_profile", ".", "get_device", "(", ")", ".", "first_depth_sensor", "(", ")", "self", ".", "_depth_scale", "=", "sensor", ".", "get_depth_scale", "(", ")" ]
Retrieve the scale of the depth sensor.
[ "Retrieve", "the", "scale", "of", "the", "depth", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L102-L106
train
Retrieve the scale of the depth sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor._set_intrinsics
def _set_intrinsics(self): """Read the intrinsics matrix from the stream. """ strm = self._profile.get_stream(rs.stream.color) obj = strm.as_video_stream_profile().get_intrinsics() self._intrinsics[0, 0] = obj.fx self._intrinsics[1, 1] = obj.fy self._intrinsics[0,...
python
def _set_intrinsics(self): """Read the intrinsics matrix from the stream. """ strm = self._profile.get_stream(rs.stream.color) obj = strm.as_video_stream_profile().get_intrinsics() self._intrinsics[0, 0] = obj.fx self._intrinsics[1, 1] = obj.fy self._intrinsics[0,...
[ "def", "_set_intrinsics", "(", "self", ")", ":", "strm", "=", "self", ".", "_profile", ".", "get_stream", "(", "rs", ".", "stream", ".", "color", ")", "obj", "=", "strm", ".", "as_video_stream_profile", "(", ")", ".", "get_intrinsics", "(", ")", "self", ...
Read the intrinsics matrix from the stream.
[ "Read", "the", "intrinsics", "matrix", "from", "the", "stream", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L108-L116
train
Read the intrinsics matrix from the stream.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor.color_intrinsics
def color_intrinsics(self): """:obj:`CameraIntrinsics` : The camera intrinsics for the RealSense color camera. """ return CameraIntrinsics( self._frame, self._intrinsics[0, 0], self._intrinsics[1, 1], self._intrinsics[0, 2], self._intri...
python
def color_intrinsics(self): """:obj:`CameraIntrinsics` : The camera intrinsics for the RealSense color camera. """ return CameraIntrinsics( self._frame, self._intrinsics[0, 0], self._intrinsics[1, 1], self._intrinsics[0, 2], self._intri...
[ "def", "color_intrinsics", "(", "self", ")", ":", "return", "CameraIntrinsics", "(", "self", ".", "_frame", ",", "self", ".", "_intrinsics", "[", "0", ",", "0", "]", ",", "self", ".", "_intrinsics", "[", "1", ",", "1", "]", ",", "self", ".", "_intrin...
:obj:`CameraIntrinsics` : The camera intrinsics for the RealSense color camera.
[ ":", "obj", ":", "CameraIntrinsics", ":", "The", "camera", "intrinsics", "for", "the", "RealSense", "color", "camera", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L119-L130
train
Return a new CameraIntrinsics object for the RealSense color camera.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor.start
def start(self): """Start the sensor. """ try: self._depth_align = False if self._registration_mode == RealSenseRegistrationMode.DEPTH_TO_COLOR: self._depth_align = True self._config_pipe() self._profile = self._pipe.start(self._cf...
python
def start(self): """Start the sensor. """ try: self._depth_align = False if self._registration_mode == RealSenseRegistrationMode.DEPTH_TO_COLOR: self._depth_align = True self._config_pipe() self._profile = self._pipe.start(self._cf...
[ "def", "start", "(", "self", ")", ":", "try", ":", "self", ".", "_depth_align", "=", "False", "if", "self", ".", "_registration_mode", "==", "RealSenseRegistrationMode", ".", "DEPTH_TO_COLOR", ":", "self", ".", "_depth_align", "=", "True", "self", ".", "_con...
Start the sensor.
[ "Start", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L156-L177
train
Start the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor.stop
def stop(self): """Stop the sensor. """ # check that everything is running if not self._running: logging.warning('Realsense not running. Aborting stop.') return False self._pipe.stop() self._running = False return True
python
def stop(self): """Stop the sensor. """ # check that everything is running if not self._running: logging.warning('Realsense not running. Aborting stop.') return False self._pipe.stop() self._running = False return True
[ "def", "stop", "(", "self", ")", ":", "# check that everything is running", "if", "not", "self", ".", "_running", ":", "logging", ".", "warning", "(", "'Realsense not running. Aborting stop.'", ")", "return", "False", "self", ".", "_pipe", ".", "stop", "(", ")",...
Stop the sensor.
[ "Stop", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L179-L189
train
Stop the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/realsense_sensor.py
RealSenseSensor._read_color_and_depth_image
def _read_color_and_depth_image(self): """Read a color and depth image from the device. """ frames = self._pipe.wait_for_frames() if self._depth_align: frames = self._align.process(frames) depth_frame = frames.get_depth_frame() color_frame = frames.get_color_...
python
def _read_color_and_depth_image(self): """Read a color and depth image from the device. """ frames = self._pipe.wait_for_frames() if self._depth_align: frames = self._align.process(frames) depth_frame = frames.get_depth_frame() color_frame = frames.get_color_...
[ "def", "_read_color_and_depth_image", "(", "self", ")", ":", "frames", "=", "self", ".", "_pipe", ".", "wait_for_frames", "(", ")", "if", "self", ".", "_depth_align", ":", "frames", "=", "self", ".", "_align", ".", "process", "(", "frames", ")", "depth_fra...
Read a color and depth image from the device.
[ "Read", "a", "color", "and", "depth", "image", "from", "the", "device", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/realsense_sensor.py#L200-L229
train
Read a color and depth image from the device.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/webcam_sensor.py
WebcamSensor.start
def start(self): """Start the sensor. """ self._cap = cv2.VideoCapture(self._device_id + cv2.CAP_V4L2) if not self._cap.isOpened(): self._running = False self._cap.release() self._cap = None return False self._cap.set(cv2.CAP_PROP_...
python
def start(self): """Start the sensor. """ self._cap = cv2.VideoCapture(self._device_id + cv2.CAP_V4L2) if not self._cap.isOpened(): self._running = False self._cap.release() self._cap = None return False self._cap.set(cv2.CAP_PROP_...
[ "def", "start", "(", "self", ")", ":", "self", ".", "_cap", "=", "cv2", ".", "VideoCapture", "(", "self", ".", "_device_id", "+", "cv2", ".", "CAP_V4L2", ")", "if", "not", "self", ".", "_cap", ".", "isOpened", "(", ")", ":", "self", ".", "_running"...
Start the sensor.
[ "Start", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/webcam_sensor.py#L69-L87
train
Start the webcam sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/webcam_sensor.py
WebcamSensor.stop
def stop(self): """Stop the sensor. """ # Check that everything is running if not self._running: logging.warning('Webcam not running. Aborting stop') return False if self._cap: self._cap.release() self._cap = None self._run...
python
def stop(self): """Stop the sensor. """ # Check that everything is running if not self._running: logging.warning('Webcam not running. Aborting stop') return False if self._cap: self._cap.release() self._cap = None self._run...
[ "def", "stop", "(", "self", ")", ":", "# Check that everything is running", "if", "not", "self", ".", "_running", ":", "logging", ".", "warning", "(", "'Webcam not running. Aborting stop'", ")", "return", "False", "if", "self", ".", "_cap", ":", "self", ".", "...
Stop the sensor.
[ "Stop", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/webcam_sensor.py#L89-L102
train
Stop the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/webcam_sensor.py
WebcamSensor.frames
def frames(self, most_recent=False): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- most_recent: bool If true, the OpenCV buffer is emptied for the webcam before reading the most recent frame...
python
def frames(self, most_recent=False): """Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- most_recent: bool If true, the OpenCV buffer is emptied for the webcam before reading the most recent frame...
[ "def", "frames", "(", "self", ",", "most_recent", "=", "False", ")", ":", "if", "most_recent", ":", "for", "i", "in", "xrange", "(", "4", ")", ":", "self", ".", "_cap", ".", "grab", "(", ")", "for", "i", "in", "range", "(", "1", ")", ":", "if",...
Retrieve a new frame from the PhoXi and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- most_recent: bool If true, the OpenCV buffer is emptied for the webcam before reading the most recent frame. Returns ------- :obj:...
[ "Retrieve", "a", "new", "frame", "from", "the", "PhoXi", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/webcam_sensor.py#L104-L132
train
Retrieve a new frame from the PhoXi and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor._set_format
def _set_format(self, msg): """ Set the buffer formatting. """ num_points = msg.height * msg.width self._format = '<' + num_points * 'ffff'
python
def _set_format(self, msg): """ Set the buffer formatting. """ num_points = msg.height * msg.width self._format = '<' + num_points * 'ffff'
[ "def", "_set_format", "(", "self", ",", "msg", ")", ":", "num_points", "=", "msg", ".", "height", "*", "msg", ".", "width", "self", ".", "_format", "=", "'<'", "+", "num_points", "*", "'ffff'" ]
Set the buffer formatting.
[ "Set", "the", "buffer", "formatting", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L42-L45
train
Set the buffer formatting.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor._set_camera_properties
def _set_camera_properties(self, msg): """ Set the camera intrinsics from an info msg. """ focal_x = msg.K[0] focal_y = msg.K[4] center_x = msg.K[2] center_y = msg.K[5] im_height = msg.height im_width = msg.width self._camera_intr = CameraIntrinsics(self._...
python
def _set_camera_properties(self, msg): """ Set the camera intrinsics from an info msg. """ focal_x = msg.K[0] focal_y = msg.K[4] center_x = msg.K[2] center_y = msg.K[5] im_height = msg.height im_width = msg.width self._camera_intr = CameraIntrinsics(self._...
[ "def", "_set_camera_properties", "(", "self", ",", "msg", ")", ":", "focal_x", "=", "msg", ".", "K", "[", "0", "]", "focal_y", "=", "msg", ".", "K", "[", "4", "]", "center_x", "=", "msg", ".", "K", "[", "2", "]", "center_y", "=", "msg", ".", "K...
Set the camera intrinsics from an info msg.
[ "Set", "the", "camera", "intrinsics", "from", "an", "info", "msg", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L47-L58
train
Set the camera intrinsics from an info msg.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor._depth_im_from_pointcloud
def _depth_im_from_pointcloud(self, msg): """ Convert a pointcloud2 message to a depth image. """ # set format if self._format is None: self._set_format(msg) # rescale camera intr in case binning is turned on if msg.height != self._camera_intr.height: res...
python
def _depth_im_from_pointcloud(self, msg): """ Convert a pointcloud2 message to a depth image. """ # set format if self._format is None: self._set_format(msg) # rescale camera intr in case binning is turned on if msg.height != self._camera_intr.height: res...
[ "def", "_depth_im_from_pointcloud", "(", "self", ",", "msg", ")", ":", "# set format", "if", "self", ".", "_format", "is", "None", ":", "self", ".", "_set_format", "(", "msg", ")", "# rescale camera intr in case binning is turned on", "if", "msg", ".", "height", ...
Convert a pointcloud2 message to a depth image.
[ "Convert", "a", "pointcloud2", "message", "to", "a", "depth", "image", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L60-L84
train
Convert a pointcloud2 message to a depth image.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor.start
def start(self): """ Start the sensor """ # initialize subscribers self._pointcloud_sub = rospy.Subscriber('/%s/depth/points' %(self.frame), PointCloud2, self._pointcloud_callback) self._camera_info_sub = rospy.Subscriber('/%s/left/camera_info' %(self.frame), CameraInfo, self._camera_inf...
python
def start(self): """ Start the sensor """ # initialize subscribers self._pointcloud_sub = rospy.Subscriber('/%s/depth/points' %(self.frame), PointCloud2, self._pointcloud_callback) self._camera_info_sub = rospy.Subscriber('/%s/left/camera_info' %(self.frame), CameraInfo, self._camera_inf...
[ "def", "start", "(", "self", ")", ":", "# initialize subscribers", "self", ".", "_pointcloud_sub", "=", "rospy", ".", "Subscriber", "(", "'/%s/depth/points'", "%", "(", "self", ".", "frame", ")", ",", "PointCloud2", ",", "self", ".", "_pointcloud_callback", ")...
Start the sensor
[ "Start", "the", "sensor" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L113-L122
train
Start the sensor
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor.stop
def stop(self): """ Stop the sensor """ # check that everything is running if not self._running: logging.warning('Ensenso not running. Aborting stop') return False # stop subs self._pointcloud_sub.unregister() self._camera_info_sub.unregister() ...
python
def stop(self): """ Stop the sensor """ # check that everything is running if not self._running: logging.warning('Ensenso not running. Aborting stop') return False # stop subs self._pointcloud_sub.unregister() self._camera_info_sub.unregister() ...
[ "def", "stop", "(", "self", ")", ":", "# check that everything is running", "if", "not", "self", ".", "_running", ":", "logging", ".", "warning", "(", "'Ensenso not running. Aborting stop'", ")", "return", "False", "# stop subs", "self", ".", "_pointcloud_sub", ".",...
Stop the sensor
[ "Stop", "the", "sensor" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L124-L135
train
Stop the sensor
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/ensenso_sensor.py
EnsensoSensor.frames
def frames(self): """Retrieve a new frame from the Ensenso and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage...
python
def frames(self): """Retrieve a new frame from the Ensenso and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage...
[ "def", "frames", "(", "self", ")", ":", "# wait for a new image", "while", "self", ".", "_cur_depth_im", "is", "None", ":", "time", ".", "sleep", "(", "0.01", ")", "# read next image", "depth_im", "=", "self", ".", "_cur_depth_im", "color_im", "=", "ColorImage...
Retrieve a new frame from the Ensenso and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage of the current frame. ...
[ "Retrieve", "a", "new", "frame", "from", "the", "Ensenso", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/ensenso_sensor.py#L137-L161
train
Retrieve a new frame from the Ensenso and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/point_registration.py
IterativeRegistrationSolver.register
def register(self, source_point_cloud, target_point_cloud, source_normal_cloud, target_normal_cloud, matcher, num_iterations=1, compute_total_cost=True, match_centroids=False, vis=False): """ Iteratively register objects to one another. Parameters ...
python
def register(self, source_point_cloud, target_point_cloud, source_normal_cloud, target_normal_cloud, matcher, num_iterations=1, compute_total_cost=True, match_centroids=False, vis=False): """ Iteratively register objects to one another. Parameters ...
[ "def", "register", "(", "self", ",", "source_point_cloud", ",", "target_point_cloud", ",", "source_normal_cloud", ",", "target_normal_cloud", ",", "matcher", ",", "num_iterations", "=", "1", ",", "compute_total_cost", "=", "True", ",", "match_centroids", "=", "False...
Iteratively register objects to one another. Parameters ---------- source_point_cloud : :obj:`autolab_core.PointCloud` source object points target_point_cloud : :obj`autolab_core.PointCloud` target object points source_normal_cloud : :obj:`autolab_core.No...
[ "Iteratively", "register", "objects", "to", "one", "another", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/point_registration.py#L32-L62
train
Iteratively register objects to one another.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/point_registration.py
PointToPlaneICPSolver.register
def register(self, source_point_cloud, target_point_cloud, source_normal_cloud, target_normal_cloud, matcher, num_iterations=1, compute_total_cost=True, match_centroids=False, vis=False): """ Iteratively register objects to one another using a modified ...
python
def register(self, source_point_cloud, target_point_cloud, source_normal_cloud, target_normal_cloud, matcher, num_iterations=1, compute_total_cost=True, match_centroids=False, vis=False): """ Iteratively register objects to one another using a modified ...
[ "def", "register", "(", "self", ",", "source_point_cloud", ",", "target_point_cloud", ",", "source_normal_cloud", ",", "target_normal_cloud", ",", "matcher", ",", "num_iterations", "=", "1", ",", "compute_total_cost", "=", "True", ",", "match_centroids", "=", "False...
Iteratively register objects to one another using a modified version of point to plane ICP. The cost func is PointToPlane_COST + gamma * PointToPoint_COST. Uses a `stochastic Gauss-Newton step` where on each iteration a smaller number of points is sampled. Parameters ---------- ...
[ "Iteratively", "register", "objects", "to", "one", "another", "using", "a", "modified", "version", "of", "point", "to", "plane", "ICP", ".", "The", "cost", "func", "is", "PointToPlane_COST", "+", "gamma", "*", "PointToPoint_COST", ".", "Uses", "a", "stochastic...
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/point_registration.py#L85-L240
train
This method registers the source and target point clouds with the target point clouds.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/camera_sensor.py
VirtualSensor.frames
def frames(self): """Retrieve the next frame from the image directory and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj...
python
def frames(self): """Retrieve the next frame from the image directory and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj...
[ "def", "frames", "(", "self", ")", ":", "if", "not", "self", ".", "_running", ":", "raise", "RuntimeError", "(", "'Device pointing to %s not runnning. Cannot read frames'", "%", "(", "self", ".", "_path_to_images", ")", ")", "if", "self", ".", "_im_index", ">=",...
Retrieve the next frame from the image directory and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj:`tuple` of :obj:`ColorImage`...
[ "Retrieve", "the", "next", "frame", "from", "the", "image", "directory", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_sensor.py#L190-L222
train
Retrieve the next frame from the image directory and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/camera_sensor.py
VirtualSensor.median_depth_img
def median_depth_img(self, num_img=1): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The median Dep...
python
def median_depth_img(self, num_img=1): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The median Dep...
[ "def", "median_depth_img", "(", "self", ",", "num_img", "=", "1", ")", ":", "depths", "=", "[", "]", "for", "_", "in", "range", "(", "num_img", ")", ":", "_", ",", "depth", ",", "_", "=", "self", ".", "frames", "(", ")", "depths", ".", "append", ...
Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The median DepthImage collected from the frames.
[ "Collect", "a", "series", "of", "depth", "images", "and", "return", "the", "median", "of", "the", "set", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_sensor.py#L224-L243
train
Collect a series of depth images and return the median of the set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/camera_sensor.py
TensorDatasetVirtualSensor.frames
def frames(self): """Retrieve the next frame from the tensor dataset and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj:...
python
def frames(self): """Retrieve the next frame from the tensor dataset and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj:...
[ "def", "frames", "(", "self", ")", ":", "if", "not", "self", ".", "_running", ":", "raise", "RuntimeError", "(", "'Device pointing to %s not runnning. Cannot read frames'", "%", "(", "self", ".", "_path_to_images", ")", ")", "if", "self", ".", "_im_index", ">=",...
Retrieve the next frame from the tensor dataset and convert it to a ColorImage, a DepthImage, and an IrImage. Parameters ---------- skip_registration : bool If True, the registration step is skipped. Returns ------- :obj:`tuple` of :obj:`ColorImage`,...
[ "Retrieve", "the", "next", "frame", "from", "the", "tensor", "dataset", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/camera_sensor.py#L275-L312
train
Retrieve the next frame from the tensor dataset and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor.color_intrinsics
def color_intrinsics(self): """:obj:`CameraIntrinsics` : The camera intrinsics for the primesense color camera. """ return CameraIntrinsics(self._ir_frame, PrimesenseSensor.FOCAL_X, PrimesenseSensor.FOCAL_Y, PrimesenseSensor.CENTER_X, PrimesenseSensor.CENTER_Y, ...
python
def color_intrinsics(self): """:obj:`CameraIntrinsics` : The camera intrinsics for the primesense color camera. """ return CameraIntrinsics(self._ir_frame, PrimesenseSensor.FOCAL_X, PrimesenseSensor.FOCAL_Y, PrimesenseSensor.CENTER_X, PrimesenseSensor.CENTER_Y, ...
[ "def", "color_intrinsics", "(", "self", ")", ":", "return", "CameraIntrinsics", "(", "self", ".", "_ir_frame", ",", "PrimesenseSensor", ".", "FOCAL_X", ",", "PrimesenseSensor", ".", "FOCAL_Y", ",", "PrimesenseSensor", ".", "CENTER_X", ",", "PrimesenseSensor", ".",...
:obj:`CameraIntrinsics` : The camera intrinsics for the primesense color camera.
[ ":", "obj", ":", "CameraIntrinsics", ":", "The", "camera", "intrinsics", "for", "the", "primesense", "color", "camera", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L67-L73
train
Returns a new CameraIntrinsics object for the primesense color camera.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor.start
def start(self): """ Start the sensor """ # open device openni2.initialize(PrimesenseSensor.OPENNI2_PATH) self._device = openni2.Device.open_any() # open depth stream self._depth_stream = self._device.create_depth_stream() self._depth_stream.configure_mode(Primes...
python
def start(self): """ Start the sensor """ # open device openni2.initialize(PrimesenseSensor.OPENNI2_PATH) self._device = openni2.Device.open_any() # open depth stream self._depth_stream = self._device.create_depth_stream() self._depth_stream.configure_mode(Primes...
[ "def", "start", "(", "self", ")", ":", "# open device", "openni2", ".", "initialize", "(", "PrimesenseSensor", ".", "OPENNI2_PATH", ")", "self", ".", "_device", "=", "openni2", ".", "Device", ".", "open_any", "(", ")", "# open depth stream", "self", ".", "_d...
Start the sensor
[ "Start", "the", "sensor" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L108-L140
train
Start the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor.stop
def stop(self): """ Stop the sensor """ # check that everything is running if not self._running or self._device is None: logging.warning('Primesense not running. Aborting stop') return False # stop streams if self._depth_stream: self._depth_st...
python
def stop(self): """ Stop the sensor """ # check that everything is running if not self._running or self._device is None: logging.warning('Primesense not running. Aborting stop') return False # stop streams if self._depth_stream: self._depth_st...
[ "def", "stop", "(", "self", ")", ":", "# check that everything is running", "if", "not", "self", ".", "_running", "or", "self", ".", "_device", "is", "None", ":", "logging", ".", "warning", "(", "'Primesense not running. Aborting stop'", ")", "return", "False", ...
Stop the sensor
[ "Stop", "the", "sensor" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L142-L158
train
Stop the sensor
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor._read_depth_image
def _read_depth_image(self): """ Reads a depth image from the device """ # read raw uint16 buffer im_arr = self._depth_stream.read_frame() raw_buf = im_arr.get_buffer_as_uint16() buf_array = np.array([raw_buf[i] for i in range(PrimesenseSensor.DEPTH_IM_WIDTH * PrimesenseSensor.DE...
python
def _read_depth_image(self): """ Reads a depth image from the device """ # read raw uint16 buffer im_arr = self._depth_stream.read_frame() raw_buf = im_arr.get_buffer_as_uint16() buf_array = np.array([raw_buf[i] for i in range(PrimesenseSensor.DEPTH_IM_WIDTH * PrimesenseSensor.DE...
[ "def", "_read_depth_image", "(", "self", ")", ":", "# read raw uint16 buffer", "im_arr", "=", "self", ".", "_depth_stream", ".", "read_frame", "(", ")", "raw_buf", "=", "im_arr", ".", "get_buffer_as_uint16", "(", ")", "buf_array", "=", "np", ".", "array", "(",...
Reads a depth image from the device
[ "Reads", "a", "depth", "image", "from", "the", "device" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L160-L175
train
Reads a depth image from the device
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor._read_color_image
def _read_color_image(self): """ Reads a color image from the device """ # read raw buffer im_arr = self._color_stream.read_frame() raw_buf = im_arr.get_buffer_as_triplet() r_array = np.array([raw_buf[i][0] for i in range(PrimesenseSensor.COLOR_IM_WIDTH * PrimesenseSensor.COLOR_I...
python
def _read_color_image(self): """ Reads a color image from the device """ # read raw buffer im_arr = self._color_stream.read_frame() raw_buf = im_arr.get_buffer_as_triplet() r_array = np.array([raw_buf[i][0] for i in range(PrimesenseSensor.COLOR_IM_WIDTH * PrimesenseSensor.COLOR_I...
[ "def", "_read_color_image", "(", "self", ")", ":", "# read raw buffer", "im_arr", "=", "self", ".", "_color_stream", ".", "read_frame", "(", ")", "raw_buf", "=", "im_arr", ".", "get_buffer_as_triplet", "(", ")", "r_array", "=", "np", ".", "array", "(", "[", ...
Reads a color image from the device
[ "Reads", "a", "color", "image", "from", "the", "device" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L177-L198
train
Reads a color image from the device
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor.frames
def frames(self): """Retrieve a new frame from the Kinect and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage ...
python
def frames(self): """Retrieve a new frame from the Kinect and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage ...
[ "def", "frames", "(", "self", ")", ":", "color_im", "=", "self", ".", "_read_color_image", "(", ")", "depth_im", "=", "self", ".", "_read_depth_image", "(", ")", "return", "color_im", ",", "depth_im", ",", "None" ]
Retrieve a new frame from the Kinect and convert it to a ColorImage, a DepthImage, and an IrImage. Returns ------- :obj:`tuple` of :obj:`ColorImage`, :obj:`DepthImage`, :obj:`IrImage`, :obj:`numpy.ndarray` The ColorImage, DepthImage, and IrImage of the current frame. ...
[ "Retrieve", "a", "new", "frame", "from", "the", "Kinect", "and", "convert", "it", "to", "a", "ColorImage", "a", "DepthImage", "and", "an", "IrImage", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L200-L216
train
Retrieve a new frame from the Kinect and convert it to a ColorImage DepthImage and IrImage.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor.min_depth_img
def min_depth_img(self, num_img=1): """Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage c...
python
def min_depth_img(self, num_img=1): """Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage c...
[ "def", "min_depth_img", "(", "self", ",", "num_img", "=", "1", ")", ":", "depths", "=", "[", "]", "for", "_", "in", "range", "(", "num_img", ")", ":", "_", ",", "depth", ",", "_", "=", "self", ".", "frames", "(", ")", "depths", ".", "append", "...
Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage collected from the frames.
[ "Collect", "a", "series", "of", "depth", "images", "and", "return", "the", "min", "of", "the", "set", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L241-L260
train
Collect a series of depth images and return the min of the set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor_ROS._ros_read_images
def _ros_read_images(self, stream_buffer, number, staleness_limit = 10.): """ Reads images from a stream buffer Parameters ---------- stream_buffer : string absolute path to the image buffer service number : int The number of frames to get. Must b...
python
def _ros_read_images(self, stream_buffer, number, staleness_limit = 10.): """ Reads images from a stream buffer Parameters ---------- stream_buffer : string absolute path to the image buffer service number : int The number of frames to get. Must b...
[ "def", "_ros_read_images", "(", "self", ",", "stream_buffer", ",", "number", ",", "staleness_limit", "=", "10.", ")", ":", "rospy", ".", "wait_for_service", "(", "stream_buffer", ",", "timeout", "=", "self", ".", "timeout", ")", "ros_image_buffer", "=", "rospy...
Reads images from a stream buffer Parameters ---------- stream_buffer : string absolute path to the image buffer service number : int The number of frames to get. Must be less than the image buffer service's current buffer size stalene...
[ "Reads", "images", "from", "a", "stream", "buffer", "Parameters", "----------", "stream_buffer", ":", "string", "absolute", "path", "to", "the", "image", "buffer", "service", "number", ":", "int", "The", "number", "of", "frames", "to", "get", ".", "Must", "b...
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L312-L346
train
Reads images from a stream buffer.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor_ROS._read_depth_images
def _read_depth_images(self, num_images): """ Reads depth images from the device """ depth_images = self._ros_read_images(self._depth_image_buffer, num_images, self.staleness_limit) for i in range(0, num_images): depth_images[i] = depth_images[i] * MM_TO_METERS # convert to meters ...
python
def _read_depth_images(self, num_images): """ Reads depth images from the device """ depth_images = self._ros_read_images(self._depth_image_buffer, num_images, self.staleness_limit) for i in range(0, num_images): depth_images[i] = depth_images[i] * MM_TO_METERS # convert to meters ...
[ "def", "_read_depth_images", "(", "self", ",", "num_images", ")", ":", "depth_images", "=", "self", ".", "_ros_read_images", "(", "self", ".", "_depth_image_buffer", ",", "num_images", ",", "self", ".", "staleness_limit", ")", "for", "i", "in", "range", "(", ...
Reads depth images from the device
[ "Reads", "depth", "images", "from", "the", "device" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L360-L369
train
Reads the depth images from the device
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor_ROS._read_color_images
def _read_color_images(self, num_images): """ Reads color images from the device """ color_images = self._ros_read_images(self._color_image_buffer, num_images, self.staleness_limit) for i in range(0, num_images): if self._flip_images: color_images[i] = np.flipud(color...
python
def _read_color_images(self, num_images): """ Reads color images from the device """ color_images = self._ros_read_images(self._color_image_buffer, num_images, self.staleness_limit) for i in range(0, num_images): if self._flip_images: color_images[i] = np.flipud(color...
[ "def", "_read_color_images", "(", "self", ",", "num_images", ")", ":", "color_images", "=", "self", ".", "_ros_read_images", "(", "self", ".", "_color_image_buffer", ",", "num_images", ",", "self", ".", "staleness_limit", ")", "for", "i", "in", "range", "(", ...
Reads color images from the device
[ "Reads", "color", "images", "from", "the", "device" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L370-L378
train
Reads color images from the device
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor_ROS.median_depth_img
def median_depth_img(self, num_img=1, fill_depth=0.0): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` ...
python
def median_depth_img(self, num_img=1, fill_depth=0.0): """Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` ...
[ "def", "median_depth_img", "(", "self", ",", "num_img", "=", "1", ",", "fill_depth", "=", "0.0", ")", ":", "depths", "=", "self", ".", "_read_depth_images", "(", "num_img", ")", "median_depth", "=", "Image", ".", "median_images", "(", "depths", ")", "media...
Collect a series of depth images and return the median of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The median DepthImage collected from the frames.
[ "Collect", "a", "series", "of", "depth", "images", "and", "return", "the", "median", "of", "the", "set", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L387-L404
train
Collect a series of depth images and return the median of the set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/primesense_sensor.py
PrimesenseSensor_ROS.min_depth_img
def min_depth_img(self, num_img=1): """Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage c...
python
def min_depth_img(self, num_img=1): """Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage c...
[ "def", "min_depth_img", "(", "self", ",", "num_img", "=", "1", ")", ":", "depths", "=", "self", ".", "_read_depth_images", "(", "num_img", ")", "return", "Image", ".", "min_images", "(", "depths", ")" ]
Collect a series of depth images and return the min of the set. Parameters ---------- num_img : int The number of consecutive frames to process. Returns ------- :obj:`DepthImage` The min DepthImage collected from the frames.
[ "Collect", "a", "series", "of", "depth", "images", "and", "return", "the", "min", "of", "the", "set", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/primesense_sensor.py#L406-L421
train
Collect a series of depth images and return the min of the set.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/object_render.py
ObjectRender.T_obj_camera
def T_obj_camera(self): """Returns the transformation from camera to object when the object is in the given stable pose. Returns ------- :obj:`autolab_core.RigidTransform` The desired transform. """ if self.stable_pose is None: T_obj_world = Rigid...
python
def T_obj_camera(self): """Returns the transformation from camera to object when the object is in the given stable pose. Returns ------- :obj:`autolab_core.RigidTransform` The desired transform. """ if self.stable_pose is None: T_obj_world = Rigid...
[ "def", "T_obj_camera", "(", "self", ")", ":", "if", "self", ".", "stable_pose", "is", "None", ":", "T_obj_world", "=", "RigidTransform", "(", "from_frame", "=", "'obj'", ",", "to_frame", "=", "'world'", ")", "else", ":", "T_obj_world", "=", "self", ".", ...
Returns the transformation from camera to object when the object is in the given stable pose. Returns ------- :obj:`autolab_core.RigidTransform` The desired transform.
[ "Returns", "the", "transformation", "from", "camera", "to", "object", "when", "the", "object", "is", "in", "the", "given", "stable", "pose", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/object_render.py#L56-L69
train
Returns the transformation from camera to object when the object is in the given stable pose.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/object_render.py
QueryImageBundle.image
def image(self, render_mode): """Return an image generated with a particular render mode. Parameters ---------- render_mode : :obj:`RenderMode` The type of image we want. Returns ------- :obj:`Image` The color, depth, or binary image if r...
python
def image(self, render_mode): """Return an image generated with a particular render mode. Parameters ---------- render_mode : :obj:`RenderMode` The type of image we want. Returns ------- :obj:`Image` The color, depth, or binary image if r...
[ "def", "image", "(", "self", ",", "render_mode", ")", ":", "if", "render_mode", "==", "RenderMode", ".", "COLOR", ":", "return", "self", ".", "color_im", "elif", "render_mode", "==", "RenderMode", ".", "DEPTH", ":", "return", "self", ".", "depth_im", "elif...
Return an image generated with a particular render mode. Parameters ---------- render_mode : :obj:`RenderMode` The type of image we want. Returns ------- :obj:`Image` The color, depth, or binary image if render_mode is COLOR, DEPTH, o...
[ "Return", "an", "image", "generated", "with", "a", "particular", "render", "mode", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/object_render.py#L110-L131
train
Returns an image generated with a particular render mode.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/chessboard_registration.py
CameraChessboardRegistration.register
def register(sensor, config): """ Registers a camera to a chessboard. Parameters ---------- sensor : :obj:`perception.RgbdSensor` the sensor to register config : :obj:`autolab_core.YamlConfig` or :obj:`dict` configuration file for registration ...
python
def register(sensor, config): """ Registers a camera to a chessboard. Parameters ---------- sensor : :obj:`perception.RgbdSensor` the sensor to register config : :obj:`autolab_core.YamlConfig` or :obj:`dict` configuration file for registration ...
[ "def", "register", "(", "sensor", ",", "config", ")", ":", "# read config", "num_transform_avg", "=", "config", "[", "'num_transform_avg'", "]", "num_images", "=", "config", "[", "'num_images'", "]", "sx", "=", "config", "[", "'corners_x'", "]", "sy", "=", "...
Registers a camera to a chessboard. Parameters ---------- sensor : :obj:`perception.RgbdSensor` the sensor to register config : :obj:`autolab_core.YamlConfig` or :obj:`dict` configuration file for registration Returns ------- :obj:`Chessb...
[ "Registers", "a", "camera", "to", "a", "chessboard", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/chessboard_registration.py#L35-L228
train
Registers a camera to a chessboard.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/features.py
BagOfFeatures.add
def add(self, feature): """ Add a new feature to the bag. Parameters ---------- feature : :obj:`Feature` feature to add """ self.features_.append(feature) self.num_features_ = len(self.features_)
python
def add(self, feature): """ Add a new feature to the bag. Parameters ---------- feature : :obj:`Feature` feature to add """ self.features_.append(feature) self.num_features_ = len(self.features_)
[ "def", "add", "(", "self", ",", "feature", ")", ":", "self", ".", "features_", ".", "append", "(", "feature", ")", "self", ".", "num_features_", "=", "len", "(", "self", ".", "features_", ")" ]
Add a new feature to the bag. Parameters ---------- feature : :obj:`Feature` feature to add
[ "Add", "a", "new", "feature", "to", "the", "bag", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/features.py#L109-L118
train
Adds a new feature to the bag.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/features.py
BagOfFeatures.extend
def extend(self, features): """ Add a list of features to the bag. Parameters ---------- feature : :obj:`list` of :obj:`Feature` features to add """ self.features_.extend(features) self.num_features_ = len(self.features_)
python
def extend(self, features): """ Add a list of features to the bag. Parameters ---------- feature : :obj:`list` of :obj:`Feature` features to add """ self.features_.extend(features) self.num_features_ = len(self.features_)
[ "def", "extend", "(", "self", ",", "features", ")", ":", "self", ".", "features_", ".", "extend", "(", "features", ")", "self", ".", "num_features_", "=", "len", "(", "self", ".", "features_", ")" ]
Add a list of features to the bag. Parameters ---------- feature : :obj:`list` of :obj:`Feature` features to add
[ "Add", "a", "list", "of", "features", "to", "the", "bag", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/features.py#L120-L129
train
Adds a list of features to the bag.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/features.py
BagOfFeatures.feature
def feature(self, index): """ Returns a feature. Parameters ---------- index : int index of feature in list Returns ------- :obj:`Feature` """ if index < 0 or index >= self.num_features_: raise ValueError('Index %d out of ...
python
def feature(self, index): """ Returns a feature. Parameters ---------- index : int index of feature in list Returns ------- :obj:`Feature` """ if index < 0 or index >= self.num_features_: raise ValueError('Index %d out of ...
[ "def", "feature", "(", "self", ",", "index", ")", ":", "if", "index", "<", "0", "or", "index", ">=", "self", ".", "num_features_", ":", "raise", "ValueError", "(", "'Index %d out of range'", "%", "(", "index", ")", ")", "return", "self", ".", "features_"...
Returns a feature. Parameters ---------- index : int index of feature in list Returns ------- :obj:`Feature`
[ "Returns", "a", "feature", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/features.py#L131-L145
train
Returns a feature in the list at the specified index.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/features.py
BagOfFeatures.feature_subset
def feature_subset(self, indices): """ Returns some subset of the features. Parameters ---------- indices : :obj:`list` of :obj:`int` indices of the features in the list Returns ------- :obj:`list` of :obj:`Feature` """ if isi...
python
def feature_subset(self, indices): """ Returns some subset of the features. Parameters ---------- indices : :obj:`list` of :obj:`int` indices of the features in the list Returns ------- :obj:`list` of :obj:`Feature` """ if isi...
[ "def", "feature_subset", "(", "self", ",", "indices", ")", ":", "if", "isinstance", "(", "indices", ",", "np", ".", "ndarray", ")", ":", "indices", "=", "indices", ".", "tolist", "(", ")", "if", "not", "isinstance", "(", "indices", ",", "list", ")", ...
Returns some subset of the features. Parameters ---------- indices : :obj:`list` of :obj:`int` indices of the features in the list Returns ------- :obj:`list` of :obj:`Feature`
[ "Returns", "some", "subset", "of", "the", "features", ".", "Parameters", "----------", "indices", ":", ":", "obj", ":", "list", "of", ":", "obj", ":", "int", "indices", "of", "the", "features", "in", "the", "list" ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/features.py#L147-L163
train
Returns some subset of the features.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/weight_sensor.py
WeightSensor.start
def start(self): """Start the sensor. """ if rospy.get_name() == '/unnamed': raise ValueError('Weight sensor must be run inside a ros node!') self._weight_subscriber = rospy.Subscriber('weight_sensor/weights', Float32MultiArray, self._weights_callback) self._running =...
python
def start(self): """Start the sensor. """ if rospy.get_name() == '/unnamed': raise ValueError('Weight sensor must be run inside a ros node!') self._weight_subscriber = rospy.Subscriber('weight_sensor/weights', Float32MultiArray, self._weights_callback) self._running =...
[ "def", "start", "(", "self", ")", ":", "if", "rospy", ".", "get_name", "(", ")", "==", "'/unnamed'", ":", "raise", "ValueError", "(", "'Weight sensor must be run inside a ros node!'", ")", "self", ".", "_weight_subscriber", "=", "rospy", ".", "Subscriber", "(", ...
Start the sensor.
[ "Start", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L35-L41
train
Start the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/weight_sensor.py
WeightSensor.stop
def stop(self): """Stop the sensor. """ if not self._running: return self._weight_subscriber.unregister() self._running = False
python
def stop(self): """Stop the sensor. """ if not self._running: return self._weight_subscriber.unregister() self._running = False
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "_running", ":", "return", "self", ".", "_weight_subscriber", ".", "unregister", "(", ")", "self", ".", "_running", "=", "False" ]
Stop the sensor.
[ "Stop", "the", "sensor", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L44-L50
train
Stop the sensor.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/weight_sensor.py
WeightSensor.total_weight
def total_weight(self): """Read a weight from the sensor in grams. Returns ------- weight : float The sensor weight in grams. """ weights = self._raw_weights() if weights.shape[1] == 0: return 0.0 elif weights.shape[1] < self._ntap...
python
def total_weight(self): """Read a weight from the sensor in grams. Returns ------- weight : float The sensor weight in grams. """ weights = self._raw_weights() if weights.shape[1] == 0: return 0.0 elif weights.shape[1] < self._ntap...
[ "def", "total_weight", "(", "self", ")", ":", "weights", "=", "self", ".", "_raw_weights", "(", ")", "if", "weights", ".", "shape", "[", "1", "]", "==", "0", ":", "return", "0.0", "elif", "weights", ".", "shape", "[", "1", "]", "<", "self", ".", ...
Read a weight from the sensor in grams. Returns ------- weight : float The sensor weight in grams.
[ "Read", "a", "weight", "from", "the", "sensor", "in", "grams", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L53-L67
train
Read a weight from the sensor in grams.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...
BerkeleyAutomation/perception
perception/weight_sensor.py
WeightSensor.individual_weights
def individual_weights(self): """Read individual weights from the load cells in grams. Returns ------- weight : float The sensor weight in grams. """ weights = self._raw_weights() if weights.shape[1] == 0: return np.zeros(weights.shape[0])...
python
def individual_weights(self): """Read individual weights from the load cells in grams. Returns ------- weight : float The sensor weight in grams. """ weights = self._raw_weights() if weights.shape[1] == 0: return np.zeros(weights.shape[0])...
[ "def", "individual_weights", "(", "self", ")", ":", "weights", "=", "self", ".", "_raw_weights", "(", ")", "if", "weights", ".", "shape", "[", "1", "]", "==", "0", ":", "return", "np", ".", "zeros", "(", "weights", ".", "shape", "[", "0", "]", ")",...
Read individual weights from the load cells in grams. Returns ------- weight : float The sensor weight in grams.
[ "Read", "individual", "weights", "from", "the", "load", "cells", "in", "grams", "." ]
03d9b37dd6b66896cdfe173905c9413c8c3c5df6
https://github.com/BerkeleyAutomation/perception/blob/03d9b37dd6b66896cdfe173905c9413c8c3c5df6/perception/weight_sensor.py#L69-L83
train
Read individual weights from the load cells in grams.
GiP5xwVCF98Z,B3LV8Eo811Ma,bIsJhlpYrrU2,UtiWT6f6p9yZ,sY2ClS3bs_Vs,cXy7eDEmqBLX,WBIJpxagI_Bm,oiYQtqKByLVy,pKtZbyLPTF7M,N5KuUvtbiyqB,Y8CO_HpFZe1H,lFpHwHL3xiEO,QT_5wdIFQ3WX,gn988v5t9NEf,dVZxwLTOCtbO,RjQP07DYIdkf,Wun5u3i1rn23,m64e4RQAlmFd,zfo2Sgkz3IVJ,aWb0eXvJHTT7,s2y8nAB4S7UF,znAfcqx_89tO,ZnHlCcECsuOK,TdYHRT1SBW60,mBmBrDJU...