repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
ChristianKuehnel/btlewrap
btlewrap/bluepy.py
wrap_exception
def wrap_exception(func: Callable) -> Callable: """Decorator to wrap BTLEExceptions into BluetoothBackendException.""" try: # only do the wrapping if bluepy is installed. # otherwise it's pointless anyway from bluepy.btle import BTLEException except ImportError: return func ...
python
def wrap_exception(func: Callable) -> Callable: """Decorator to wrap BTLEExceptions into BluetoothBackendException.""" try: # only do the wrapping if bluepy is installed. # otherwise it's pointless anyway from bluepy.btle import BTLEException except ImportError: return func ...
[ "def", "wrap_exception", "(", "func", ":", "Callable", ")", "->", "Callable", ":", "try", ":", "from", "bluepy", ".", "btle", "import", "BTLEException", "except", "ImportError", ":", "return", "func", "def", "_func_wrapper", "(", "*", "args", ",", "**", "k...
Decorator to wrap BTLEExceptions into BluetoothBackendException.
[ "Decorator", "to", "wrap", "BTLEExceptions", "into", "BluetoothBackendException", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/bluepy.py#L13-L35
train
ChristianKuehnel/btlewrap
btlewrap/bluepy.py
BluepyBackend.write_handle
def write_handle(self, handle: int, value: bytes): """Write a handle from the device. You must be connected to do this. """ if self._peripheral is None: raise BluetoothBackendException('not connected to backend') return self._peripheral.writeCharacteristic(handle, va...
python
def write_handle(self, handle: int, value: bytes): """Write a handle from the device. You must be connected to do this. """ if self._peripheral is None: raise BluetoothBackendException('not connected to backend') return self._peripheral.writeCharacteristic(handle, va...
[ "def", "write_handle", "(", "self", ",", "handle", ":", "int", ",", "value", ":", "bytes", ")", ":", "if", "self", ".", "_peripheral", "is", "None", ":", "raise", "BluetoothBackendException", "(", "'not connected to backend'", ")", "return", "self", ".", "_p...
Write a handle from the device. You must be connected to do this.
[ "Write", "a", "handle", "from", "the", "device", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/bluepy.py#L79-L86
train
ChristianKuehnel/btlewrap
btlewrap/bluepy.py
BluepyBackend.check_backend
def check_backend() -> bool: """Check if the backend is available.""" try: import bluepy.btle # noqa: F401 #pylint: disable=unused-import return True except ImportError as importerror: _LOGGER.error('bluepy not found: %s', str(importerror)) return Fal...
python
def check_backend() -> bool: """Check if the backend is available.""" try: import bluepy.btle # noqa: F401 #pylint: disable=unused-import return True except ImportError as importerror: _LOGGER.error('bluepy not found: %s', str(importerror)) return Fal...
[ "def", "check_backend", "(", ")", "->", "bool", ":", "try", ":", "import", "bluepy", ".", "btle", "return", "True", "except", "ImportError", "as", "importerror", ":", "_LOGGER", ".", "error", "(", "'bluepy not found: %s'", ",", "str", "(", "importerror", ")"...
Check if the backend is available.
[ "Check", "if", "the", "backend", "is", "available", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/bluepy.py#L97-L104
train
ChristianKuehnel/btlewrap
btlewrap/bluepy.py
BluepyBackend.scan_for_devices
def scan_for_devices(timeout: float) -> List[Tuple[str, str]]: """Scan for bluetooth low energy devices. Note this must be run as root!""" from bluepy.btle import Scanner scanner = Scanner() result = [] for device in scanner.scan(timeout): result.append((dev...
python
def scan_for_devices(timeout: float) -> List[Tuple[str, str]]: """Scan for bluetooth low energy devices. Note this must be run as root!""" from bluepy.btle import Scanner scanner = Scanner() result = [] for device in scanner.scan(timeout): result.append((dev...
[ "def", "scan_for_devices", "(", "timeout", ":", "float", ")", "->", "List", "[", "Tuple", "[", "str", ",", "str", "]", "]", ":", "from", "bluepy", ".", "btle", "import", "Scanner", "scanner", "=", "Scanner", "(", ")", "result", "=", "[", "]", "for", ...
Scan for bluetooth low energy devices. Note this must be run as root!
[ "Scan", "for", "bluetooth", "low", "energy", "devices", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/bluepy.py#L108-L118
train
ChristianKuehnel/btlewrap
btlewrap/gatttool.py
wrap_exception
def wrap_exception(func: Callable) -> Callable: """Wrap all IOErrors to BluetoothBackendException""" def _func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except IOError as exception: raise BluetoothBackendException() from exception return _func_wrapp...
python
def wrap_exception(func: Callable) -> Callable: """Wrap all IOErrors to BluetoothBackendException""" def _func_wrapper(*args, **kwargs): try: return func(*args, **kwargs) except IOError as exception: raise BluetoothBackendException() from exception return _func_wrapp...
[ "def", "wrap_exception", "(", "func", ":", "Callable", ")", "->", "Callable", ":", "def", "_func_wrapper", "(", "*", "args", ",", "**", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "**", "kwargs", ")", "except", "IOError", ...
Wrap all IOErrors to BluetoothBackendException
[ "Wrap", "all", "IOErrors", "to", "BluetoothBackendException" ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/gatttool.py#L19-L27
train
ChristianKuehnel/btlewrap
btlewrap/gatttool.py
GatttoolBackend.write_handle
def write_handle(self, handle: int, value: bytes): # noqa: C901 # pylint: disable=arguments-differ """Read from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX @param: value - value to write...
python
def write_handle(self, handle: int, value: bytes): # noqa: C901 # pylint: disable=arguments-differ """Read from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX @param: value - value to write...
[ "def", "write_handle", "(", "self", ",", "handle", ":", "int", ",", "value", ":", "bytes", ")", ":", "if", "not", "self", ".", "is_connected", "(", ")", ":", "raise", "BluetoothBackendException", "(", "'Not connected to any device.'", ")", "attempt", "=", "0...
Read from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX @param: value - value to write to the given handle
[ "Read", "from", "a", "BLE", "address", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/gatttool.py#L62-L116
train
ChristianKuehnel/btlewrap
btlewrap/gatttool.py
GatttoolBackend.wait_for_notification
def wait_for_notification(self, handle: int, delegate, notification_timeout: float): """Listen for characteristics changes from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX a value of 0x0...
python
def wait_for_notification(self, handle: int, delegate, notification_timeout: float): """Listen for characteristics changes from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX a value of 0x0...
[ "def", "wait_for_notification", "(", "self", ",", "handle", ":", "int", ",", "delegate", ",", "notification_timeout", ":", "float", ")", ":", "if", "not", "self", ".", "is_connected", "(", ")", ":", "raise", "BluetoothBackendException", "(", "'Not connected to a...
Listen for characteristics changes from a BLE address. @param: mac - MAC address in format XX:XX:XX:XX:XX:XX @param: handle - BLE characteristics handle in format 0xXX a value of 0x0100 is written to register for listening @param: delegate - gatttool receives the ...
[ "Listen", "for", "characteristics", "changes", "from", "a", "BLE", "address", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/gatttool.py#L119-L176
train
ChristianKuehnel/btlewrap
btlewrap/gatttool.py
GatttoolBackend.check_backend
def check_backend() -> bool: """Check if gatttool is available on the system.""" try: call('gatttool', stdout=PIPE, stderr=PIPE) return True except OSError as os_err: msg = 'gatttool not found: {}'.format(str(os_err)) _LOGGER.error(msg) ret...
python
def check_backend() -> bool: """Check if gatttool is available on the system.""" try: call('gatttool', stdout=PIPE, stderr=PIPE) return True except OSError as os_err: msg = 'gatttool not found: {}'.format(str(os_err)) _LOGGER.error(msg) ret...
[ "def", "check_backend", "(", ")", "->", "bool", ":", "try", ":", "call", "(", "'gatttool'", ",", "stdout", "=", "PIPE", ",", "stderr", "=", "PIPE", ")", "return", "True", "except", "OSError", "as", "os_err", ":", "msg", "=", "'gatttool not found: {}'", "...
Check if gatttool is available on the system.
[ "Check", "if", "gatttool", "is", "available", "on", "the", "system", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/gatttool.py#L260-L268
train
ChristianKuehnel/btlewrap
btlewrap/gatttool.py
GatttoolBackend.bytes_to_string
def bytes_to_string(raw_data: bytes, prefix: bool = False) -> str: """Convert a byte array to a hex string.""" prefix_string = '' if prefix: prefix_string = '0x' suffix = ''.join([format(c, "02x") for c in raw_data]) return prefix_string + suffix.upper()
python
def bytes_to_string(raw_data: bytes, prefix: bool = False) -> str: """Convert a byte array to a hex string.""" prefix_string = '' if prefix: prefix_string = '0x' suffix = ''.join([format(c, "02x") for c in raw_data]) return prefix_string + suffix.upper()
[ "def", "bytes_to_string", "(", "raw_data", ":", "bytes", ",", "prefix", ":", "bool", "=", "False", ")", "->", "str", ":", "prefix_string", "=", "''", "if", "prefix", ":", "prefix_string", "=", "'0x'", "suffix", "=", "''", ".", "join", "(", "[", "format...
Convert a byte array to a hex string.
[ "Convert", "a", "byte", "array", "to", "a", "hex", "string", "." ]
1b7aec934529dcf03f5ecdccd0b09c25c389974f
https://github.com/ChristianKuehnel/btlewrap/blob/1b7aec934529dcf03f5ecdccd0b09c25c389974f/btlewrap/gatttool.py#L276-L282
train
datacamp/antlr-ast
antlr_ast/marshalling.py
decode_ast
def decode_ast(registry, ast_json): """JSON decoder for BaseNodes""" if ast_json.get("@type"): subclass = registry.get_cls(ast_json["@type"], tuple(ast_json["@fields"])) return subclass( ast_json["children"], ast_json["field_references"], ast_json["label_refer...
python
def decode_ast(registry, ast_json): """JSON decoder for BaseNodes""" if ast_json.get("@type"): subclass = registry.get_cls(ast_json["@type"], tuple(ast_json["@fields"])) return subclass( ast_json["children"], ast_json["field_references"], ast_json["label_refer...
[ "def", "decode_ast", "(", "registry", ",", "ast_json", ")", ":", "if", "ast_json", ".", "get", "(", "\"@type\"", ")", ":", "subclass", "=", "registry", ".", "get_cls", "(", "ast_json", "[", "\"@type\"", "]", ",", "tuple", "(", "ast_json", "[", "\"@fields...
JSON decoder for BaseNodes
[ "JSON", "decoder", "for", "BaseNodes" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/marshalling.py#L27-L38
train
datacamp/antlr-ast
antlr_ast/ast.py
simplify_tree
def simplify_tree(tree, unpack_lists=True, in_list=False): """Recursively unpack single-item lists and objects where fields and labels only reference a single child :param tree: the tree to simplify (mutating!) :param unpack_lists: whether single-item lists should be replaced by that item :param in_lis...
python
def simplify_tree(tree, unpack_lists=True, in_list=False): """Recursively unpack single-item lists and objects where fields and labels only reference a single child :param tree: the tree to simplify (mutating!) :param unpack_lists: whether single-item lists should be replaced by that item :param in_lis...
[ "def", "simplify_tree", "(", "tree", ",", "unpack_lists", "=", "True", ",", "in_list", "=", "False", ")", ":", "if", "isinstance", "(", "tree", ",", "BaseNode", ")", "and", "not", "isinstance", "(", "tree", ",", "Terminal", ")", ":", "used_fields", "=", ...
Recursively unpack single-item lists and objects where fields and labels only reference a single child :param tree: the tree to simplify (mutating!) :param unpack_lists: whether single-item lists should be replaced by that item :param in_list: this is used to prevent unpacking a node in a list as AST visit...
[ "Recursively", "unpack", "single", "-", "item", "lists", "and", "objects", "where", "fields", "and", "labels", "only", "reference", "a", "single", "child" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L521-L563
train
datacamp/antlr-ast
antlr_ast/ast.py
get_field
def get_field(ctx, field): """Helper to get the value of a field""" # field can be a string or a node attribute if isinstance(field, str): field = getattr(ctx, field, None) # when not alias needs to be called if callable(field): field = field() # when alias set on token, need to ...
python
def get_field(ctx, field): """Helper to get the value of a field""" # field can be a string or a node attribute if isinstance(field, str): field = getattr(ctx, field, None) # when not alias needs to be called if callable(field): field = field() # when alias set on token, need to ...
[ "def", "get_field", "(", "ctx", ",", "field", ")", ":", "if", "isinstance", "(", "field", ",", "str", ")", ":", "field", "=", "getattr", "(", "ctx", ",", "field", ",", "None", ")", "if", "callable", "(", "field", ")", ":", "field", "=", "field", ...
Helper to get the value of a field
[ "Helper", "to", "get", "the", "value", "of", "a", "field" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L641-L657
train
datacamp/antlr-ast
antlr_ast/ast.py
get_field_names
def get_field_names(ctx): """Get fields defined in an ANTLR context for a parser rule""" # this does not include labels and literals, only rule names and token names # TODO: check ANTLR parser template for full exclusion list fields = [ field for field in type(ctx).__dict__ if no...
python
def get_field_names(ctx): """Get fields defined in an ANTLR context for a parser rule""" # this does not include labels and literals, only rule names and token names # TODO: check ANTLR parser template for full exclusion list fields = [ field for field in type(ctx).__dict__ if no...
[ "def", "get_field_names", "(", "ctx", ")", ":", "fields", "=", "[", "field", "for", "field", "in", "type", "(", "ctx", ")", ".", "__dict__", "if", "not", "field", ".", "startswith", "(", "\"__\"", ")", "and", "field", "not", "in", "[", "\"accept\"", ...
Get fields defined in an ANTLR context for a parser rule
[ "Get", "fields", "defined", "in", "an", "ANTLR", "context", "for", "a", "parser", "rule" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L707-L717
train
datacamp/antlr-ast
antlr_ast/ast.py
get_label_names
def get_label_names(ctx): """Get labels defined in an ANTLR context for a parser rule""" labels = [ label for label in ctx.__dict__ if not label.startswith("_") and label not in [ "children", "exception", "invokingState", "p...
python
def get_label_names(ctx): """Get labels defined in an ANTLR context for a parser rule""" labels = [ label for label in ctx.__dict__ if not label.startswith("_") and label not in [ "children", "exception", "invokingState", "p...
[ "def", "get_label_names", "(", "ctx", ")", ":", "labels", "=", "[", "label", "for", "label", "in", "ctx", ".", "__dict__", "if", "not", "label", ".", "startswith", "(", "\"_\"", ")", "and", "label", "not", "in", "[", "\"children\"", ",", "\"exception\"",...
Get labels defined in an ANTLR context for a parser rule
[ "Get", "labels", "defined", "in", "an", "ANTLR", "context", "for", "a", "parser", "rule" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L720-L737
train
datacamp/antlr-ast
antlr_ast/ast.py
Speaker.get_info
def get_info(node_cfg): """Return a tuple with the verbal name of a node, and a dict of field names.""" node_cfg = node_cfg if isinstance(node_cfg, dict) else {"name": node_cfg} return node_cfg.get("name"), node_cfg.get("fields", {})
python
def get_info(node_cfg): """Return a tuple with the verbal name of a node, and a dict of field names.""" node_cfg = node_cfg if isinstance(node_cfg, dict) else {"name": node_cfg} return node_cfg.get("name"), node_cfg.get("fields", {})
[ "def", "get_info", "(", "node_cfg", ")", ":", "node_cfg", "=", "node_cfg", "if", "isinstance", "(", "node_cfg", ",", "dict", ")", "else", "{", "\"name\"", ":", "node_cfg", "}", "return", "node_cfg", ".", "get", "(", "\"name\"", ")", ",", "node_cfg", ".",...
Return a tuple with the verbal name of a node, and a dict of field names.
[ "Return", "a", "tuple", "with", "the", "verbal", "name", "of", "a", "node", "and", "a", "dict", "of", "field", "names", "." ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L143-L148
train
datacamp/antlr-ast
antlr_ast/ast.py
BaseNodeRegistry.isinstance
def isinstance(self, instance, class_name): """Check if a BaseNode is an instance of a registered dynamic class""" if isinstance(instance, BaseNode): klass = self.dynamic_node_classes.get(class_name, None) if klass: return isinstance(instance, klass) #...
python
def isinstance(self, instance, class_name): """Check if a BaseNode is an instance of a registered dynamic class""" if isinstance(instance, BaseNode): klass = self.dynamic_node_classes.get(class_name, None) if klass: return isinstance(instance, klass) #...
[ "def", "isinstance", "(", "self", ",", "instance", ",", "class_name", ")", ":", "if", "isinstance", "(", "instance", ",", "BaseNode", ")", ":", "klass", "=", "self", ".", "dynamic_node_classes", ".", "get", "(", "class_name", ",", "None", ")", "if", "kla...
Check if a BaseNode is an instance of a registered dynamic class
[ "Check", "if", "a", "BaseNode", "is", "an", "instance", "of", "a", "registered", "dynamic", "class" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L207-L216
train
datacamp/antlr-ast
antlr_ast/ast.py
AliasNode.get_transformer
def get_transformer(cls, method_name): """Get method to bind to visitor""" transform_function = getattr(cls, method_name) assert callable(transform_function) def transformer_method(self, node): kwargs = {} if inspect.signature(transform_function).parameters.get("...
python
def get_transformer(cls, method_name): """Get method to bind to visitor""" transform_function = getattr(cls, method_name) assert callable(transform_function) def transformer_method(self, node): kwargs = {} if inspect.signature(transform_function).parameters.get("...
[ "def", "get_transformer", "(", "cls", ",", "method_name", ")", ":", "transform_function", "=", "getattr", "(", "cls", ",", "method_name", ")", "assert", "callable", "(", "transform_function", ")", "def", "transformer_method", "(", "self", ",", "node", ")", ":"...
Get method to bind to visitor
[ "Get", "method", "to", "bind", "to", "visitor" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L445-L456
train
datacamp/antlr-ast
antlr_ast/ast.py
BaseAstVisitor.visitTerminal
def visitTerminal(self, ctx): """Converts case insensitive keywords and identifiers to lowercase""" text = ctx.getText() return Terminal.from_text(text, ctx)
python
def visitTerminal(self, ctx): """Converts case insensitive keywords and identifiers to lowercase""" text = ctx.getText() return Terminal.from_text(text, ctx)
[ "def", "visitTerminal", "(", "self", ",", "ctx", ")", ":", "text", "=", "ctx", ".", "getText", "(", ")", "return", "Terminal", ".", "from_text", "(", "text", ",", "ctx", ")" ]
Converts case insensitive keywords and identifiers to lowercase
[ "Converts", "case", "insensitive", "keywords", "and", "identifiers", "to", "lowercase" ]
d08d5eb2e663bd40501d0eeddc8a731ac7e96b11
https://github.com/datacamp/antlr-ast/blob/d08d5eb2e663bd40501d0eeddc8a731ac7e96b11/antlr_ast/ast.py#L629-L632
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/blacklist.py
Blacklist.run
def run(self, *args): """List, add or delete entries from the blacklist. By default, it prints the list of entries available on the blacklist. """ params = self.parser.parse_args(args) entry = params.entry if params.add: code = self.add(entry) ...
python
def run(self, *args): """List, add or delete entries from the blacklist. By default, it prints the list of entries available on the blacklist. """ params = self.parser.parse_args(args) entry = params.entry if params.add: code = self.add(entry) ...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "entry", "=", "params", ".", "entry", "if", "params", ".", "add", ":", "code", "=", "self", ".", "add", "(", "entry"...
List, add or delete entries from the blacklist. By default, it prints the list of entries available on the blacklist.
[ "List", "add", "or", "delete", "entries", "from", "the", "blacklist", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/blacklist.py#L80-L98
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/blacklist.py
Blacklist.add
def add(self, entry): """Add entries to the blacklist. This method adds the given 'entry' to the blacklist. :param entry: entry to add to the blacklist """ # Empty or None values for organizations are not allowed if not entry: return CMD_SUCCESS try...
python
def add(self, entry): """Add entries to the blacklist. This method adds the given 'entry' to the blacklist. :param entry: entry to add to the blacklist """ # Empty or None values for organizations are not allowed if not entry: return CMD_SUCCESS try...
[ "def", "add", "(", "self", ",", "entry", ")", ":", "if", "not", "entry", ":", "return", "CMD_SUCCESS", "try", ":", "api", ".", "add_to_matching_blacklist", "(", "self", ".", "db", ",", "entry", ")", "except", "InvalidValueError", "as", "e", ":", "raise",...
Add entries to the blacklist. This method adds the given 'entry' to the blacklist. :param entry: entry to add to the blacklist
[ "Add", "entries", "to", "the", "blacklist", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/blacklist.py#L100-L122
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/blacklist.py
Blacklist.delete
def delete(self, entry): """Remove entries from the blacklist. The method removes the given 'entry' from the blacklist. :param entry: entry to remove from the blacklist """ if not entry: return CMD_SUCCESS try: api.delete_from_matching_blacklist...
python
def delete(self, entry): """Remove entries from the blacklist. The method removes the given 'entry' from the blacklist. :param entry: entry to remove from the blacklist """ if not entry: return CMD_SUCCESS try: api.delete_from_matching_blacklist...
[ "def", "delete", "(", "self", ",", "entry", ")", ":", "if", "not", "entry", ":", "return", "CMD_SUCCESS", "try", ":", "api", ".", "delete_from_matching_blacklist", "(", "self", ".", "db", ",", "entry", ")", "except", "NotFoundError", "as", "e", ":", "sel...
Remove entries from the blacklist. The method removes the given 'entry' from the blacklist. :param entry: entry to remove from the blacklist
[ "Remove", "entries", "from", "the", "blacklist", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/blacklist.py#L124-L140
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/blacklist.py
Blacklist.blacklist
def blacklist(self, term=None): """List blacklisted entries. When no term is given, the method will list the entries that exist in the blacklist. If 'term' is set, the method will list only those entries that match with that term. :param term: term to match """ ...
python
def blacklist(self, term=None): """List blacklisted entries. When no term is given, the method will list the entries that exist in the blacklist. If 'term' is set, the method will list only those entries that match with that term. :param term: term to match """ ...
[ "def", "blacklist", "(", "self", ",", "term", "=", "None", ")", ":", "try", ":", "bl", "=", "api", ".", "blacklist", "(", "self", ".", "db", ",", "term", ")", "self", ".", "display", "(", "'blacklist.tmpl'", ",", "blacklist", "=", "bl", ")", "excep...
List blacklisted entries. When no term is given, the method will list the entries that exist in the blacklist. If 'term' is set, the method will list only those entries that match with that term. :param term: term to match
[ "List", "blacklisted", "entries", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/blacklist.py#L142-L158
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/config.py
Config.run
def run(self, *args): """Get and set configuration parameters. This command gets or sets parameter values from the user configuration file. On Linux systems, configuration will be stored in the file '~/.sortinghat'. """ params = self.parser.parse_args(args) conf...
python
def run(self, *args): """Get and set configuration parameters. This command gets or sets parameter values from the user configuration file. On Linux systems, configuration will be stored in the file '~/.sortinghat'. """ params = self.parser.parse_args(args) conf...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "config_file", "=", "os", ".", "path", ".", "expanduser", "(", "'~/.sortinghat'", ")", "if", "params", ".", "action", "=...
Get and set configuration parameters. This command gets or sets parameter values from the user configuration file. On Linux systems, configuration will be stored in the file '~/.sortinghat'.
[ "Get", "and", "set", "configuration", "parameters", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/config.py#L80-L98
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/config.py
Config.get
def get(self, key, filepath): """Get configuration parameter. Reads 'key' configuration parameter from the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to get :param filepath: config...
python
def get(self, key, filepath): """Get configuration parameter. Reads 'key' configuration parameter from the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to get :param filepath: config...
[ "def", "get", "(", "self", ",", "key", ",", "filepath", ")", ":", "if", "not", "filepath", ":", "raise", "RuntimeError", "(", "\"Configuration file not given\"", ")", "if", "not", "self", ".", "__check_config_key", "(", "key", ")", ":", "raise", "RuntimeErro...
Get configuration parameter. Reads 'key' configuration parameter from the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to get :param filepath: configuration file
[ "Get", "configuration", "parameter", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/config.py#L100-L130
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/config.py
Config.set
def set(self, key, value, filepath): """Set configuration parameter. Writes 'value' on 'key' to the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to set :param value: value to set ...
python
def set(self, key, value, filepath): """Set configuration parameter. Writes 'value' on 'key' to the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to set :param value: value to set ...
[ "def", "set", "(", "self", ",", "key", ",", "value", ",", "filepath", ")", ":", "if", "not", "filepath", ":", "raise", "RuntimeError", "(", "\"Configuration file not given\"", ")", "if", "not", "self", ".", "__check_config_key", "(", "key", ")", ":", "rais...
Set configuration parameter. Writes 'value' on 'key' to the configuration file given in 'filepath'. Configuration parameter in 'key' must follow the schema <section>.<option> . :param key: key to set :param value: value to set :param filepath: configuration file
[ "Set", "configuration", "parameter", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/config.py#L132-L170
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/config.py
Config.__check_config_key
def __check_config_key(self, key): """Check whether the key is valid. A valid key has the schema <section>.<option>. Keys supported are listed in CONFIG_OPTIONS dict. :param key: <section>.<option> key """ try: section, option = key.split('.') except...
python
def __check_config_key(self, key): """Check whether the key is valid. A valid key has the schema <section>.<option>. Keys supported are listed in CONFIG_OPTIONS dict. :param key: <section>.<option> key """ try: section, option = key.split('.') except...
[ "def", "__check_config_key", "(", "self", ",", "key", ")", ":", "try", ":", "section", ",", "option", "=", "key", ".", "split", "(", "'.'", ")", "except", "(", "AttributeError", ",", "ValueError", ")", ":", "return", "False", "if", "not", "section", "o...
Check whether the key is valid. A valid key has the schema <section>.<option>. Keys supported are listed in CONFIG_OPTIONS dict. :param key: <section>.<option> key
[ "Check", "whether", "the", "key", "is", "valid", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/config.py#L172-L189
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/export.py
Export.run
def run(self, *args): """Export data from the registry. By default, it writes the data to the standard output. If a positional argument is given, it will write the data on that file. """ params = self.parser.parse_args(args) with params.outfile as outfile: ...
python
def run(self, *args): """Export data from the registry. By default, it writes the data to the standard output. If a positional argument is given, it will write the data on that file. """ params = self.parser.parse_args(args) with params.outfile as outfile: ...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "with", "params", ".", "outfile", "as", "outfile", ":", "if", "params", ".", "identities", ":", "code", "=", "self", "...
Export data from the registry. By default, it writes the data to the standard output. If a positional argument is given, it will write the data on that file.
[ "Export", "data", "from", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/export.py#L82-L100
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/export.py
Export.export_identities
def export_identities(self, outfile, source=None): """Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which have one or more ...
python
def export_identities(self, outfile, source=None): """Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which have one or more ...
[ "def", "export_identities", "(", "self", ",", "outfile", ",", "source", "=", "None", ")", ":", "exporter", "=", "SortingHatIdentitiesExporter", "(", "self", ".", "db", ")", "dump", "=", "exporter", ".", "export", "(", "source", ")", "try", ":", "outfile", ...
Export identities information to a file. The method exports information related to unique identities, to the given 'outfile' output file. When 'source' parameter is given, only those unique identities which have one or more identities from the given source will be exported. :p...
[ "Export", "identities", "information", "to", "a", "file", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/export.py#L102-L124
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/export.py
Export.export_organizations
def export_organizations(self, outfile): """Export organizations information to a file. The method exports information related to organizations, to the given 'outfile' output file. :param outfile: destination file object """ exporter = SortingHatOrganizationsExporter(se...
python
def export_organizations(self, outfile): """Export organizations information to a file. The method exports information related to organizations, to the given 'outfile' output file. :param outfile: destination file object """ exporter = SortingHatOrganizationsExporter(se...
[ "def", "export_organizations", "(", "self", ",", "outfile", ")", ":", "exporter", "=", "SortingHatOrganizationsExporter", "(", "self", ".", "db", ")", "dump", "=", "exporter", ".", "export", "(", ")", "try", ":", "outfile", ".", "write", "(", "dump", ")", ...
Export organizations information to a file. The method exports information related to organizations, to the given 'outfile' output file. :param outfile: destination file object
[ "Export", "organizations", "information", "to", "a", "file", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/export.py#L126-L144
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/export.py
SortingHatIdentitiesExporter.export
def export(self, source=None): """Export a set of unique identities. Method to export unique identities from the registry. Identities schema will follow Sorting Hat JSON format. When source parameter is given, only those unique identities which have one or more identities from ...
python
def export(self, source=None): """Export a set of unique identities. Method to export unique identities from the registry. Identities schema will follow Sorting Hat JSON format. When source parameter is given, only those unique identities which have one or more identities from ...
[ "def", "export", "(", "self", ",", "source", "=", "None", ")", ":", "uidentities", "=", "{", "}", "uids", "=", "api", ".", "unique_identities", "(", "self", ".", "db", ",", "source", "=", "source", ")", "for", "uid", "in", "uids", ":", "enrollments",...
Export a set of unique identities. Method to export unique identities from the registry. Identities schema will follow Sorting Hat JSON format. When source parameter is given, only those unique identities which have one or more identities from the given source will be exported. ...
[ "Export", "a", "set", "of", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/export.py#L168-L205
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/export.py
SortingHatOrganizationsExporter.export
def export(self): """Export a set of organizations. Method to export organizations from the registry. Organizations schema will follow Sorting Hat JSON format. :returns: a JSON formatted str """ organizations = {} orgs = api.registry(self.db) for org i...
python
def export(self): """Export a set of organizations. Method to export organizations from the registry. Organizations schema will follow Sorting Hat JSON format. :returns: a JSON formatted str """ organizations = {} orgs = api.registry(self.db) for org i...
[ "def", "export", "(", "self", ")", ":", "organizations", "=", "{", "}", "orgs", "=", "api", ".", "registry", "(", "self", ".", "db", ")", "for", "org", "in", "orgs", ":", "domains", "=", "[", "{", "'domain'", ":", "dom", ".", "domain", ",", "'is_...
Export a set of organizations. Method to export organizations from the registry. Organizations schema will follow Sorting Hat JSON format. :returns: a JSON formatted str
[ "Export", "a", "set", "of", "organizations", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/export.py#L237-L264
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autoprofile.py
AutoProfile.run
def run(self, *args): """Autocomplete profile information.""" params = self.parser.parse_args(args) sources = params.source code = self.autocomplete(sources) return code
python
def run(self, *args): """Autocomplete profile information.""" params = self.parser.parse_args(args) sources = params.source code = self.autocomplete(sources) return code
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "sources", "=", "params", ".", "source", "code", "=", "self", ".", "autocomplete", "(", "sources", ")", "return", "code"...
Autocomplete profile information.
[ "Autocomplete", "profile", "information", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autoprofile.py#L71-L78
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autoprofile.py
AutoProfile.autocomplete
def autocomplete(self, sources): """Autocomplete unique identities profiles. Autocomplete unique identities profiles using the information of their identities. The selection of the data used to fill the profile is prioritized using a list of sources. """ email_pattern = ...
python
def autocomplete(self, sources): """Autocomplete unique identities profiles. Autocomplete unique identities profiles using the information of their identities. The selection of the data used to fill the profile is prioritized using a list of sources. """ email_pattern = ...
[ "def", "autocomplete", "(", "self", ",", "sources", ")", ":", "email_pattern", "=", "re", ".", "compile", "(", "EMAIL_ADDRESS_REGEX", ")", "identities", "=", "self", ".", "__select_autocomplete_identities", "(", "sources", ")", "for", "uuid", ",", "ids", "in",...
Autocomplete unique identities profiles. Autocomplete unique identities profiles using the information of their identities. The selection of the data used to fill the profile is prioritized using a list of sources.
[ "Autocomplete", "unique", "identities", "profiles", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autoprofile.py#L80-L125
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autoprofile.py
AutoProfile.__select_autocomplete_identities
def __select_autocomplete_identities(self, sources): """Select the identities used for autocompleting""" MIN_PRIORITY = 99999999 checked = {} for source in sources: uids = api.unique_identities(self.db, source=source) for uid in uids: if uid.uu...
python
def __select_autocomplete_identities(self, sources): """Select the identities used for autocompleting""" MIN_PRIORITY = 99999999 checked = {} for source in sources: uids = api.unique_identities(self.db, source=source) for uid in uids: if uid.uu...
[ "def", "__select_autocomplete_identities", "(", "self", ",", "sources", ")", ":", "MIN_PRIORITY", "=", "99999999", "checked", "=", "{", "}", "for", "source", "in", "sources", ":", "uids", "=", "api", ".", "unique_identities", "(", "self", ".", "db", ",", "...
Select the identities used for autocompleting
[ "Select", "the", "identities", "used", "for", "autocompleting" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autoprofile.py#L127-L161
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/show.py
Show.run
def run(self, *args): """Show information about unique identities.""" params = self.parser.parse_args(args) code = self.show(params.uuid, params.term) return code
python
def run(self, *args): """Show information about unique identities.""" params = self.parser.parse_args(args) code = self.show(params.uuid, params.term) return code
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "code", "=", "self", ".", "show", "(", "params", ".", "uuid", ",", "params", ".", "term", ")", "return", "code" ]
Show information about unique identities.
[ "Show", "information", "about", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/show.py#L74-L81
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/show.py
Show.show
def show(self, uuid=None, term=None): """Show the information related to unique identities. This method prints information related to unique identities such as identities or enrollments. When <uuid> is given, it will only show information about the unique identity related to <u...
python
def show(self, uuid=None, term=None): """Show the information related to unique identities. This method prints information related to unique identities such as identities or enrollments. When <uuid> is given, it will only show information about the unique identity related to <u...
[ "def", "show", "(", "self", ",", "uuid", "=", "None", ",", "term", "=", "None", ")", ":", "try", ":", "if", "uuid", ":", "uidentities", "=", "api", ".", "unique_identities", "(", "self", ".", "db", ",", "uuid", ")", "elif", "term", ":", "uidentitie...
Show the information related to unique identities. This method prints information related to unique identities such as identities or enrollments. When <uuid> is given, it will only show information about the unique identity related to <uuid>. When <term> is set, it will only s...
[ "Show", "the", "information", "related", "to", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/show.py#L83-L118
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/stackalytics.py
StackalyticsParser.__parse_organizations
def __parse_organizations(self, json): """Parse Stackalytics organizations. The Stackalytics organizations format is a JSON document stored under the "companies" key. The next JSON shows the structure of the document: { "companies" : [ { ...
python
def __parse_organizations(self, json): """Parse Stackalytics organizations. The Stackalytics organizations format is a JSON document stored under the "companies" key. The next JSON shows the structure of the document: { "companies" : [ { ...
[ "def", "__parse_organizations", "(", "self", ",", "json", ")", ":", "try", ":", "for", "company", "in", "json", "[", "'companies'", "]", ":", "name", "=", "self", ".", "__encode", "(", "company", "[", "'company_name'", "]", ")", "org", "=", "self", "."...
Parse Stackalytics organizations. The Stackalytics organizations format is a JSON document stored under the "companies" key. The next JSON shows the structure of the document: { "companies" : [ { "domains": ["alcatel-lucent.com"], ...
[ "Parse", "Stackalytics", "organizations", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/stackalytics.py#L80-L128
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/stackalytics.py
StackalyticsParser.__parse_identities
def __parse_identities(self, json): """Parse identities using Stackalytics format. The Stackalytics identities format is a JSON document under the "users" key. The document should follow the next schema: { "users": [ { "launchpad_id": "0-...
python
def __parse_identities(self, json): """Parse identities using Stackalytics format. The Stackalytics identities format is a JSON document under the "users" key. The document should follow the next schema: { "users": [ { "launchpad_id": "0-...
[ "def", "__parse_identities", "(", "self", ",", "json", ")", ":", "try", ":", "for", "user", "in", "json", "[", "'users'", "]", ":", "name", "=", "self", ".", "__encode", "(", "user", "[", "'user_name'", "]", ")", "uuid", "=", "name", "uid", "=", "U...
Parse identities using Stackalytics format. The Stackalytics identities format is a JSON document under the "users" key. The document should follow the next schema: { "users": [ { "launchpad_id": "0-jsmith", "gerrit_id": "jsmi...
[ "Parse", "identities", "using", "Stackalytics", "format", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/stackalytics.py#L130-L207
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/stackalytics.py
StackalyticsParser.__parse_enrollments
def __parse_enrollments(self, user): """Parse user enrollments""" enrollments = [] for company in user['companies']: name = company['company_name'] org = self._organizations.get(name, None) if not org: org = Organization(name=name) ...
python
def __parse_enrollments(self, user): """Parse user enrollments""" enrollments = [] for company in user['companies']: name = company['company_name'] org = self._organizations.get(name, None) if not org: org = Organization(name=name) ...
[ "def", "__parse_enrollments", "(", "self", ",", "user", ")", ":", "enrollments", "=", "[", "]", "for", "company", "in", "user", "[", "'companies'", "]", ":", "name", "=", "company", "[", "'company_name'", "]", "org", "=", "self", ".", "_organizations", "...
Parse user enrollments
[ "Parse", "user", "enrollments" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/stackalytics.py#L209-L233
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/stackalytics.py
StackalyticsParser.__load_json
def __load_json(self, stream): """Load json stream into a dict object """ import json try: return json.loads(stream) except ValueError as e: cause = "invalid json format. %s" % str(e) raise InvalidFormatError(cause=cause)
python
def __load_json(self, stream): """Load json stream into a dict object """ import json try: return json.loads(stream) except ValueError as e: cause = "invalid json format. %s" % str(e) raise InvalidFormatError(cause=cause)
[ "def", "__load_json", "(", "self", ",", "stream", ")", ":", "import", "json", "try", ":", "return", "json", ".", "loads", "(", "stream", ")", "except", "ValueError", "as", "e", ":", "cause", "=", "\"invalid json format. %s\"", "%", "str", "(", "e", ")", ...
Load json stream into a dict object
[ "Load", "json", "stream", "into", "a", "dict", "object" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/stackalytics.py#L235-L244
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mailmap.py
MailmapParser.__parse
def __parse(self, stream, has_orgs): """Parse identities and organizations using mailmap format. Mailmap format is a text plain document that stores on each line a map between an email address and its aliases. Each line follows any of the next formats: Proper Name <commit@e...
python
def __parse(self, stream, has_orgs): """Parse identities and organizations using mailmap format. Mailmap format is a text plain document that stores on each line a map between an email address and its aliases. Each line follows any of the next formats: Proper Name <commit@e...
[ "def", "__parse", "(", "self", ",", "stream", ",", "has_orgs", ")", ":", "if", "has_orgs", ":", "self", ".", "__parse_organizations", "(", "stream", ")", "else", ":", "self", ".", "__parse_identities", "(", "stream", ")" ]
Parse identities and organizations using mailmap format. Mailmap format is a text plain document that stores on each line a map between an email address and its aliases. Each line follows any of the next formats: Proper Name <commit@email.xx> <proper@email.xx> <commit@e...
[ "Parse", "identities", "and", "organizations", "using", "mailmap", "format", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mailmap.py#L80-L105
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mailmap.py
MailmapParser.__parse_organizations
def __parse_organizations(self, stream): """Parse organizations stream""" for aliases in self.__parse_stream(stream): # Parse identity identity = self.__parse_alias(aliases[1]) uuid = identity.email uid = self._identities.get(uuid, None) if ...
python
def __parse_organizations(self, stream): """Parse organizations stream""" for aliases in self.__parse_stream(stream): # Parse identity identity = self.__parse_alias(aliases[1]) uuid = identity.email uid = self._identities.get(uuid, None) if ...
[ "def", "__parse_organizations", "(", "self", ",", "stream", ")", ":", "for", "aliases", "in", "self", ".", "__parse_stream", "(", "stream", ")", ":", "identity", "=", "self", ".", "__parse_alias", "(", "aliases", "[", "1", "]", ")", "uuid", "=", "identit...
Parse organizations stream
[ "Parse", "organizations", "stream" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mailmap.py#L107-L135
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mailmap.py
MailmapParser.__parse_identities
def __parse_identities(self, stream): """Parse identities stream""" for aliases in self.__parse_stream(stream): identity = self.__parse_alias(aliases[0]) uuid = identity.email uid = self._identities.get(uuid, None) if not uid: uid = Uniq...
python
def __parse_identities(self, stream): """Parse identities stream""" for aliases in self.__parse_stream(stream): identity = self.__parse_alias(aliases[0]) uuid = identity.email uid = self._identities.get(uuid, None) if not uid: uid = Uniq...
[ "def", "__parse_identities", "(", "self", ",", "stream", ")", ":", "for", "aliases", "in", "self", ".", "__parse_stream", "(", "stream", ")", ":", "identity", "=", "self", ".", "__parse_alias", "(", "aliases", "[", "0", "]", ")", "uuid", "=", "identity",...
Parse identities stream
[ "Parse", "identities", "stream" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mailmap.py#L137-L161
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mailmap.py
MailmapParser.__parse_stream
def __parse_stream(self, stream): """Generic method to parse mailmap streams""" nline = 0 lines = stream.split('\n') for line in lines: nline += 1 # Ignore blank lines and comments m = re.match(self.LINES_TO_IGNORE_REGEX, line, re.UNICODE) ...
python
def __parse_stream(self, stream): """Generic method to parse mailmap streams""" nline = 0 lines = stream.split('\n') for line in lines: nline += 1 # Ignore blank lines and comments m = re.match(self.LINES_TO_IGNORE_REGEX, line, re.UNICODE) ...
[ "def", "__parse_stream", "(", "self", ",", "stream", ")", ":", "nline", "=", "0", "lines", "=", "stream", ".", "split", "(", "'\\n'", ")", "for", "line", "in", "lines", ":", "nline", "+=", "1", "m", "=", "re", ".", "match", "(", "self", ".", "LIN...
Generic method to parse mailmap streams
[ "Generic", "method", "to", "parse", "mailmap", "streams" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mailmap.py#L170-L207
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/merge.py
Merge.run
def run(self, *args): """Merge two identities. When <from_uuid> or <to_uuid> are empty the command does not have any effect. The same happens when both <from_uuid> and <to_uuid> are the same unique identity. """ params = self.parser.parse_args(args) from_uuid = ...
python
def run(self, *args): """Merge two identities. When <from_uuid> or <to_uuid> are empty the command does not have any effect. The same happens when both <from_uuid> and <to_uuid> are the same unique identity. """ params = self.parser.parse_args(args) from_uuid = ...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "from_uuid", "=", "params", ".", "from_uuid", "to_uuid", "=", "params", ".", "to_uuid", "code", "=", "self", ".", "merge...
Merge two identities. When <from_uuid> or <to_uuid> are empty the command does not have any effect. The same happens when both <from_uuid> and <to_uuid> are the same unique identity.
[ "Merge", "two", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/merge.py#L67-L81
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
create_identity_matcher
def create_identity_matcher(matcher='default', blacklist=None, sources=None, strict=True): """Create an identity matcher of the given type. Factory function that creates an identity matcher object of the type defined on 'matcher' parameter. A blacklist can also be added to i...
python
def create_identity_matcher(matcher='default', blacklist=None, sources=None, strict=True): """Create an identity matcher of the given type. Factory function that creates an identity matcher object of the type defined on 'matcher' parameter. A blacklist can also be added to i...
[ "def", "create_identity_matcher", "(", "matcher", "=", "'default'", ",", "blacklist", "=", "None", ",", "sources", "=", "None", ",", "strict", "=", "True", ")", ":", "import", "sortinghat", ".", "matching", "as", "matching", "if", "matcher", "not", "in", "...
Create an identity matcher of the given type. Factory function that creates an identity matcher object of the type defined on 'matcher' parameter. A blacklist can also be added to ignore those values while matching. :param matcher: type of the matcher :param blacklist: list of entries to ignore wh...
[ "Create", "an", "identity", "matcher", "of", "the", "given", "type", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L125-L150
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
match
def match(uidentities, matcher, fastmode=False): """Find matches in a set of unique identities. This function looks for possible similar or equal identities from a set of unique identities. The result will be a list of subsets where each subset is a list of matching identities. When `fastmode` is ...
python
def match(uidentities, matcher, fastmode=False): """Find matches in a set of unique identities. This function looks for possible similar or equal identities from a set of unique identities. The result will be a list of subsets where each subset is a list of matching identities. When `fastmode` is ...
[ "def", "match", "(", "uidentities", ",", "matcher", ",", "fastmode", "=", "False", ")", ":", "if", "not", "isinstance", "(", "matcher", ",", "IdentityMatcher", ")", ":", "raise", "TypeError", "(", "\"matcher is not an instance of IdentityMatcher\"", ")", "if", "...
Find matches in a set of unique identities. This function looks for possible similar or equal identities from a set of unique identities. The result will be a list of subsets where each subset is a list of matching identities. When `fastmode` is set a new and experimental matching algorithm will b...
[ "Find", "matches", "in", "a", "set", "of", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L153-L196
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_match
def _match(filtered, matcher): """Old method to find matches in a set of filtered identities.""" def match_filtered_identities(x, ids, matcher): """Check if an identity matches a set of identities""" for y in ids: if x.uuid == y.uuid: return True if matc...
python
def _match(filtered, matcher): """Old method to find matches in a set of filtered identities.""" def match_filtered_identities(x, ids, matcher): """Check if an identity matches a set of identities""" for y in ids: if x.uuid == y.uuid: return True if matc...
[ "def", "_match", "(", "filtered", ",", "matcher", ")", ":", "def", "match_filtered_identities", "(", "x", ",", "ids", ",", "matcher", ")", ":", "for", "y", "in", "ids", ":", "if", "x", ".", "uuid", "==", "y", ".", "uuid", ":", "return", "True", "if...
Old method to find matches in a set of filtered identities.
[ "Old", "method", "to", "find", "matches", "in", "a", "set", "of", "filtered", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L199-L234
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_match_with_pandas
def _match_with_pandas(filtered, matcher): """Find matches in a set using Pandas' library.""" import pandas data = [fl.to_dict() for fl in filtered] if not data: return [] df = pandas.DataFrame(data) df = df.sort_values(['uuid']) cdfs = [] criteria = matcher.matching_criteri...
python
def _match_with_pandas(filtered, matcher): """Find matches in a set using Pandas' library.""" import pandas data = [fl.to_dict() for fl in filtered] if not data: return [] df = pandas.DataFrame(data) df = df.sort_values(['uuid']) cdfs = [] criteria = matcher.matching_criteri...
[ "def", "_match_with_pandas", "(", "filtered", ",", "matcher", ")", ":", "import", "pandas", "data", "=", "[", "fl", ".", "to_dict", "(", ")", "for", "fl", "in", "filtered", "]", "if", "not", "data", ":", "return", "[", "]", "df", "=", "pandas", ".", ...
Find matches in a set using Pandas' library.
[ "Find", "matches", "in", "a", "set", "using", "Pandas", "library", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L237-L267
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_filter_unique_identities
def _filter_unique_identities(uidentities, matcher): """Filter a set of unique identities. This function will use the `matcher` to generate a list of `FilteredIdentity` objects. It will return a tuple with the list of filtered objects, the unique identities not filtered and a table mapping uuids wi...
python
def _filter_unique_identities(uidentities, matcher): """Filter a set of unique identities. This function will use the `matcher` to generate a list of `FilteredIdentity` objects. It will return a tuple with the list of filtered objects, the unique identities not filtered and a table mapping uuids wi...
[ "def", "_filter_unique_identities", "(", "uidentities", ",", "matcher", ")", ":", "filtered", "=", "[", "]", "no_filtered", "=", "[", "]", "uuids", "=", "{", "}", "for", "uidentity", "in", "uidentities", ":", "n", "=", "len", "(", "filtered", ")", "filte...
Filter a set of unique identities. This function will use the `matcher` to generate a list of `FilteredIdentity` objects. It will return a tuple with the list of filtered objects, the unique identities not filtered and a table mapping uuids with unique identities.
[ "Filter", "a", "set", "of", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L270-L292
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_build_matches
def _build_matches(matches, uuids, no_filtered, fastmode=False): """Build a list with matching subsets""" result = [] for m in matches: mk = m[0].uuid if not fastmode else m[0] subset = [uuids[mk]] for id_ in m[1:]: uk = id_.uuid if not fastmode else id_ u ...
python
def _build_matches(matches, uuids, no_filtered, fastmode=False): """Build a list with matching subsets""" result = [] for m in matches: mk = m[0].uuid if not fastmode else m[0] subset = [uuids[mk]] for id_ in m[1:]: uk = id_.uuid if not fastmode else id_ u ...
[ "def", "_build_matches", "(", "matches", ",", "uuids", ",", "no_filtered", ",", "fastmode", "=", "False", ")", ":", "result", "=", "[", "]", "for", "m", "in", "matches", ":", "mk", "=", "m", "[", "0", "]", ".", "uuid", "if", "not", "fastmode", "els...
Build a list with matching subsets
[ "Build", "a", "list", "with", "matching", "subsets" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L295-L321
train
chaoss/grimoirelab-sortinghat
sortinghat/matcher.py
_calculate_matches_closures
def _calculate_matches_closures(groups): """Find the transitive closure of each unique identity. This function uses a BFS algorithm to build set of matches. For instance, given a list of matched unique identities like A = {A, B}; B = {B,A,C}, C = {C,} and D = {D,} the output will be A = {A, B, C} a...
python
def _calculate_matches_closures(groups): """Find the transitive closure of each unique identity. This function uses a BFS algorithm to build set of matches. For instance, given a list of matched unique identities like A = {A, B}; B = {B,A,C}, C = {C,} and D = {D,} the output will be A = {A, B, C} a...
[ "def", "_calculate_matches_closures", "(", "groups", ")", ":", "matches", "=", "[", "]", "ns", "=", "sorted", "(", "groups", ".", "groups", ".", "keys", "(", ")", ")", "while", "ns", ":", "n", "=", "ns", ".", "pop", "(", "0", ")", "visited", "=", ...
Find the transitive closure of each unique identity. This function uses a BFS algorithm to build set of matches. For instance, given a list of matched unique identities like A = {A, B}; B = {B,A,C}, C = {C,} and D = {D,} the output will be A = {A, B, C} and D = {D,}. :param groups: groups of uniqu...
[ "Find", "the", "transitive", "closure", "of", "each", "unique", "identity", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matcher.py#L324-L360
train
chaoss/grimoirelab-sortinghat
sortinghat/matching/email_name.py
EmailNameMatcher.match
def match(self, a, b): """Determine if two unique identities are the same. This method compares the email addresses or the names of each identity to check if the given unique identities are the same. When the given unique identities are the same object or share the same UUID, th...
python
def match(self, a, b): """Determine if two unique identities are the same. This method compares the email addresses or the names of each identity to check if the given unique identities are the same. When the given unique identities are the same object or share the same UUID, th...
[ "def", "match", "(", "self", ",", "a", ",", "b", ")", ":", "if", "not", "isinstance", "(", "a", ",", "UniqueIdentity", ")", ":", "raise", "ValueError", "(", "\"<a> is not an instance of UniqueIdentity\"", ")", "if", "not", "isinstance", "(", "b", ",", "Uni...
Determine if two unique identities are the same. This method compares the email addresses or the names of each identity to check if the given unique identities are the same. When the given unique identities are the same object or share the same UUID, this will also produce a positive ma...
[ "Determine", "if", "two", "unique", "identities", "are", "the", "same", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/matching/email_name.py#L77-L112
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
find_unique_identity
def find_unique_identity(session, uuid): """Find a unique identity. Find a unique identity by its UUID using the given `session`. When the unique identity does not exist the function will return `None`. :param session: database session :param uuid: id of the unique identity to find :retur...
python
def find_unique_identity(session, uuid): """Find a unique identity. Find a unique identity by its UUID using the given `session`. When the unique identity does not exist the function will return `None`. :param session: database session :param uuid: id of the unique identity to find :retur...
[ "def", "find_unique_identity", "(", "session", ",", "uuid", ")", ":", "uidentity", "=", "session", ".", "query", "(", "UniqueIdentity", ")", ".", "filter", "(", "UniqueIdentity", ".", "uuid", "==", "uuid", ")", ".", "first", "(", ")", "return", "uidentity"...
Find a unique identity. Find a unique identity by its UUID using the given `session`. When the unique identity does not exist the function will return `None`. :param session: database session :param uuid: id of the unique identity to find :returns: a unique identity object; `None` when the un...
[ "Find", "a", "unique", "identity", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L40-L56
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
find_identity
def find_identity(session, id_): """Find an identity. Find an identity by its ID using the given `session`. When the identity does not exist the function will return `None`. :param session: database session :param id_: id of the identity to find :returns: an identity object; `None` when t...
python
def find_identity(session, id_): """Find an identity. Find an identity by its ID using the given `session`. When the identity does not exist the function will return `None`. :param session: database session :param id_: id of the identity to find :returns: an identity object; `None` when t...
[ "def", "find_identity", "(", "session", ",", "id_", ")", ":", "identity", "=", "session", ".", "query", "(", "Identity", ")", ".", "filter", "(", "Identity", ".", "id", "==", "id_", ")", ".", "first", "(", ")", "return", "identity" ]
Find an identity. Find an identity by its ID using the given `session`. When the identity does not exist the function will return `None`. :param session: database session :param id_: id of the identity to find :returns: an identity object; `None` when the identity does not exist
[ "Find", "an", "identity", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L59-L75
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
find_organization
def find_organization(session, name): """Find an organization. Find an organization by its `name` using the given `session`. When the organization does not exist the function will return `None`. :param session: database session :param name: name of the organization to find :returns: an or...
python
def find_organization(session, name): """Find an organization. Find an organization by its `name` using the given `session`. When the organization does not exist the function will return `None`. :param session: database session :param name: name of the organization to find :returns: an or...
[ "def", "find_organization", "(", "session", ",", "name", ")", ":", "organization", "=", "session", ".", "query", "(", "Organization", ")", ".", "filter", "(", "Organization", ".", "name", "==", "name", ")", ".", "first", "(", ")", "return", "organization" ...
Find an organization. Find an organization by its `name` using the given `session`. When the organization does not exist the function will return `None`. :param session: database session :param name: name of the organization to find :returns: an organization object; `None` when the organizati...
[ "Find", "an", "organization", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L78-L94
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
find_domain
def find_domain(session, name): """Find a domain. Find a domain by its domain name using the given `session`. When the domain does not exist the function will return `None`. :param session: database session :param name: name of the domain to find :returns: a domain object; `None` when the...
python
def find_domain(session, name): """Find a domain. Find a domain by its domain name using the given `session`. When the domain does not exist the function will return `None`. :param session: database session :param name: name of the domain to find :returns: a domain object; `None` when the...
[ "def", "find_domain", "(", "session", ",", "name", ")", ":", "domain", "=", "session", ".", "query", "(", "Domain", ")", ".", "filter", "(", "Domain", ".", "domain", "==", "name", ")", ".", "first", "(", ")", "return", "domain" ]
Find a domain. Find a domain by its domain name using the given `session`. When the domain does not exist the function will return `None`. :param session: database session :param name: name of the domain to find :returns: a domain object; `None` when the domain does not exist
[ "Find", "a", "domain", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L97-L113
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
find_country
def find_country(session, code): """Find a country. Find a country by its ISO-3166 `code` (i.e ES for Spain, US for United States of America) using the given `session. When the country does not exist the function will return `None`. :param session: database session :param code: ISO-3166 co...
python
def find_country(session, code): """Find a country. Find a country by its ISO-3166 `code` (i.e ES for Spain, US for United States of America) using the given `session. When the country does not exist the function will return `None`. :param session: database session :param code: ISO-3166 co...
[ "def", "find_country", "(", "session", ",", "code", ")", ":", "country", "=", "session", ".", "query", "(", "Country", ")", ".", "filter", "(", "Country", ".", "code", "==", "code", ")", ".", "first", "(", ")", "return", "country" ]
Find a country. Find a country by its ISO-3166 `code` (i.e ES for Spain, US for United States of America) using the given `session. When the country does not exist the function will return `None`. :param session: database session :param code: ISO-3166 code of the country to find :return: ...
[ "Find", "a", "country", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L116-L133
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
add_unique_identity
def add_unique_identity(session, uuid): """Add a unique identity to the session. This function adds a unique identity to the session with `uuid` string as unique identifier. This identifier cannot be empty or `None`. When the unique identity is added, a new empty profile for this object is cre...
python
def add_unique_identity(session, uuid): """Add a unique identity to the session. This function adds a unique identity to the session with `uuid` string as unique identifier. This identifier cannot be empty or `None`. When the unique identity is added, a new empty profile for this object is cre...
[ "def", "add_unique_identity", "(", "session", ",", "uuid", ")", ":", "if", "uuid", "is", "None", ":", "raise", "ValueError", "(", "\"'uuid' cannot be None\"", ")", "if", "uuid", "==", "''", ":", "raise", "ValueError", "(", "\"'uuid' cannot be an empty string\"", ...
Add a unique identity to the session. This function adds a unique identity to the session with `uuid` string as unique identifier. This identifier cannot be empty or `None`. When the unique identity is added, a new empty profile for this object is created too. As a result, the function return...
[ "Add", "a", "unique", "identity", "to", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L136-L167
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
add_identity
def add_identity(session, uidentity, identity_id, source, name=None, email=None, username=None): """Add an identity to the session. This function adds a new identity to the session using `identity_id` as its identifier. The new identity will also be linked to the unique identity object...
python
def add_identity(session, uidentity, identity_id, source, name=None, email=None, username=None): """Add an identity to the session. This function adds a new identity to the session using `identity_id` as its identifier. The new identity will also be linked to the unique identity object...
[ "def", "add_identity", "(", "session", ",", "uidentity", ",", "identity_id", ",", "source", ",", "name", "=", "None", ",", "email", "=", "None", ",", "username", "=", "None", ")", ":", "if", "identity_id", "is", "None", ":", "raise", "ValueError", "(", ...
Add an identity to the session. This function adds a new identity to the session using `identity_id` as its identifier. The new identity will also be linked to the unique identity object of `uidentity`. Neither the values given to `identity_id` nor to `source` can be `None` or empty. Moreover, `na...
[ "Add", "an", "identity", "to", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L184-L230
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
delete_identity
def delete_identity(session, identity): """Remove an identity from the session. This function removes from the session the identity given in `identity`. Take into account this function does not remove unique identities in the case they get empty. :param session: database session :param identit...
python
def delete_identity(session, identity): """Remove an identity from the session. This function removes from the session the identity given in `identity`. Take into account this function does not remove unique identities in the case they get empty. :param session: database session :param identit...
[ "def", "delete_identity", "(", "session", ",", "identity", ")", ":", "uidentity", "=", "identity", ".", "uidentity", "uidentity", ".", "last_modified", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "session", ".", "delete", "(", "identity", ")",...
Remove an identity from the session. This function removes from the session the identity given in `identity`. Take into account this function does not remove unique identities in the case they get empty. :param session: database session :param identity: identity to remove
[ "Remove", "an", "identity", "from", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L233-L247
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
add_organization
def add_organization(session, name): """Add an organization to the session. This function adds a new organization to the session, using the given `name` as an identifier. Name cannot be empty or `None`. It returns a new `Organization` object. :param session: database session :param name: ...
python
def add_organization(session, name): """Add an organization to the session. This function adds a new organization to the session, using the given `name` as an identifier. Name cannot be empty or `None`. It returns a new `Organization` object. :param session: database session :param name: ...
[ "def", "add_organization", "(", "session", ",", "name", ")", ":", "if", "name", "is", "None", ":", "raise", "ValueError", "(", "\"'name' cannot be None\"", ")", "if", "name", "==", "''", ":", "raise", "ValueError", "(", "\"'name' cannot be an empty string\"", ")...
Add an organization to the session. This function adds a new organization to the session, using the given `name` as an identifier. Name cannot be empty or `None`. It returns a new `Organization` object. :param session: database session :param name: name of the organization :return: a new...
[ "Add", "an", "organization", "to", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L250-L275
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
delete_organization
def delete_organization(session, organization): """Remove an organization from the session. Function that removes from the session the organization given in `organization`. Data related such as domains or enrollments are also removed. :param session: database session :param organization: organ...
python
def delete_organization(session, organization): """Remove an organization from the session. Function that removes from the session the organization given in `organization`. Data related such as domains or enrollments are also removed. :param session: database session :param organization: organ...
[ "def", "delete_organization", "(", "session", ",", "organization", ")", ":", "last_modified", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "for", "enrollment", "in", "organization", ".", "enrollments", ":", "enrollment", ".", "uidentity", ".", "l...
Remove an organization from the session. Function that removes from the session the organization given in `organization`. Data related such as domains or enrollments are also removed. :param session: database session :param organization: organization to remove
[ "Remove", "an", "organization", "from", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L278-L294
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
add_domain
def add_domain(session, organization, domain_name, is_top_domain=False): """Add a domain to the session. This function adds a new domain to the session using `domain_name` as its identifier. The new domain will also be linked to the organization object of `organization`. Values assigned to `domain...
python
def add_domain(session, organization, domain_name, is_top_domain=False): """Add a domain to the session. This function adds a new domain to the session using `domain_name` as its identifier. The new domain will also be linked to the organization object of `organization`. Values assigned to `domain...
[ "def", "add_domain", "(", "session", ",", "organization", ",", "domain_name", ",", "is_top_domain", "=", "False", ")", ":", "if", "domain_name", "is", "None", ":", "raise", "ValueError", "(", "\"'domain_name' cannot be None\"", ")", "if", "domain_name", "==", "'...
Add a domain to the session. This function adds a new domain to the session using `domain_name` as its identifier. The new domain will also be linked to the organization object of `organization`. Values assigned to `domain_name` cannot be `None` or empty. The parameter `is_top_domain` only accepts...
[ "Add", "a", "domain", "to", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L297-L331
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
delete_enrollment
def delete_enrollment(session, enrollment): """Remove an enrollment from the session. This function removes from the session the given enrollment. :param session: database session :param enrollment: enrollment to remove """ uidentity = enrollment.uidentity uidentity.last_modified = datetim...
python
def delete_enrollment(session, enrollment): """Remove an enrollment from the session. This function removes from the session the given enrollment. :param session: database session :param enrollment: enrollment to remove """ uidentity = enrollment.uidentity uidentity.last_modified = datetim...
[ "def", "delete_enrollment", "(", "session", ",", "enrollment", ")", ":", "uidentity", "=", "enrollment", ".", "uidentity", "uidentity", ".", "last_modified", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "session", ".", "delete", "(", "enrollment"...
Remove an enrollment from the session. This function removes from the session the given enrollment. :param session: database session :param enrollment: enrollment to remove
[ "Remove", "an", "enrollment", "from", "the", "session", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L453-L465
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
move_enrollment
def move_enrollment(session, enrollment, uidentity): """Move an enrollment to a unique identity. Shifts `enrollment` to the unique identity given in `uidentity`. The function returns whether the operation was executed successfully. When `uidentity` is the unique identity currently related to `...
python
def move_enrollment(session, enrollment, uidentity): """Move an enrollment to a unique identity. Shifts `enrollment` to the unique identity given in `uidentity`. The function returns whether the operation was executed successfully. When `uidentity` is the unique identity currently related to `...
[ "def", "move_enrollment", "(", "session", ",", "enrollment", ",", "uidentity", ")", ":", "if", "enrollment", ".", "uuid", "==", "uidentity", ".", "uuid", ":", "return", "False", "old_uidentity", "=", "enrollment", ".", "uidentity", "enrollment", ".", "uidentit...
Move an enrollment to a unique identity. Shifts `enrollment` to the unique identity given in `uidentity`. The function returns whether the operation was executed successfully. When `uidentity` is the unique identity currently related to `enrollment`, this operation does not have any effect and ...
[ "Move", "an", "enrollment", "to", "a", "unique", "identity", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L590-L622
train
chaoss/grimoirelab-sortinghat
sortinghat/db/api.py
add_to_matching_blacklist
def add_to_matching_blacklist(session, term): """Add term to the matching blacklist. This function adds a `term` to the matching blacklist. The term to add cannot have a `None` or empty value, on this case an `ValueError` will be raised. :param session: database session :param term: term, word...
python
def add_to_matching_blacklist(session, term): """Add term to the matching blacklist. This function adds a `term` to the matching blacklist. The term to add cannot have a `None` or empty value, on this case an `ValueError` will be raised. :param session: database session :param term: term, word...
[ "def", "add_to_matching_blacklist", "(", "session", ",", "term", ")", ":", "if", "term", "is", "None", ":", "raise", "ValueError", "(", "\"'term' to blacklist cannot be None\"", ")", "if", "term", "==", "''", ":", "raise", "ValueError", "(", "\"'term' to blacklist...
Add term to the matching blacklist. This function adds a `term` to the matching blacklist. The term to add cannot have a `None` or empty value, on this case an `ValueError` will be raised. :param session: database session :param term: term, word or value to blacklist :return: a new entry in t...
[ "Add", "term", "to", "the", "matching", "blacklist", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/db/api.py#L625-L647
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autogender.py
genderize
def genderize(name, api_token=None): """Fetch gender from genderize.io""" GENDERIZE_API_URL = "https://api.genderize.io/" TOTAL_RETRIES = 10 MAX_RETRIES = 5 SLEEP_TIME = 0.25 STATUS_FORCELIST = [502] params = { 'name': name } if api_token: params['apikey'] = api_to...
python
def genderize(name, api_token=None): """Fetch gender from genderize.io""" GENDERIZE_API_URL = "https://api.genderize.io/" TOTAL_RETRIES = 10 MAX_RETRIES = 5 SLEEP_TIME = 0.25 STATUS_FORCELIST = [502] params = { 'name': name } if api_token: params['apikey'] = api_to...
[ "def", "genderize", "(", "name", ",", "api_token", "=", "None", ")", ":", "GENDERIZE_API_URL", "=", "\"https://api.genderize.io/\"", "TOTAL_RETRIES", "=", "10", "MAX_RETRIES", "=", "5", "SLEEP_TIME", "=", "0.25", "STATUS_FORCELIST", "=", "[", "502", "]", "params...
Fetch gender from genderize.io
[ "Fetch", "gender", "from", "genderize", ".", "io" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autogender.py#L149-L186
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autogender.py
AutoGender.run
def run(self, *args): """Autocomplete gender information.""" params = self.parser.parse_args(args) api_token = params.api_token genderize_all = params.genderize_all code = self.autogender(api_token=api_token, genderize_all=genderize_all) r...
python
def run(self, *args): """Autocomplete gender information.""" params = self.parser.parse_args(args) api_token = params.api_token genderize_all = params.genderize_all code = self.autogender(api_token=api_token, genderize_all=genderize_all) r...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "api_token", "=", "params", ".", "api_token", "genderize_all", "=", "params", ".", "genderize_all", "code", "=", "self", "...
Autocomplete gender information.
[ "Autocomplete", "gender", "information", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autogender.py#L80-L89
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/autogender.py
AutoGender.autogender
def autogender(self, api_token=None, genderize_all=False): """Autocomplete gender information of unique identities. Autocomplete unique identities gender using genderize.io API. Only those unique identities without an assigned gender will be updated unless `genderize_all` option is give...
python
def autogender(self, api_token=None, genderize_all=False): """Autocomplete gender information of unique identities. Autocomplete unique identities gender using genderize.io API. Only those unique identities without an assigned gender will be updated unless `genderize_all` option is give...
[ "def", "autogender", "(", "self", ",", "api_token", "=", "None", ",", "genderize_all", "=", "False", ")", ":", "name_cache", "=", "{", "}", "no_gender", "=", "not", "genderize_all", "pattern", "=", "re", ".", "compile", "(", "r\"(^\\w+)\\s\\w+\"", ")", "pr...
Autocomplete gender information of unique identities. Autocomplete unique identities gender using genderize.io API. Only those unique identities without an assigned gender will be updated unless `genderize_all` option is given.
[ "Autocomplete", "gender", "information", "of", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/autogender.py#L91-L146
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/mozilla.py
MozilliansParser.__parse_identities
def __parse_identities(self, json): """Parse identities using Mozillians format. The Mozillians identities format is a JSON document under the "results" key. The document should follow the next schema: { "results" : [ { "_url": "https://example.co...
python
def __parse_identities(self, json): """Parse identities using Mozillians format. The Mozillians identities format is a JSON document under the "results" key. The document should follow the next schema: { "results" : [ { "_url": "https://example.co...
[ "def", "__parse_identities", "(", "self", ",", "json", ")", ":", "try", ":", "for", "mozillian", "in", "json", "[", "'results'", "]", ":", "name", "=", "self", ".", "__encode", "(", "mozillian", "[", "'full_name'", "]", "[", "'value'", "]", ")", "email...
Parse identities using Mozillians format. The Mozillians identities format is a JSON document under the "results" key. The document should follow the next schema: { "results" : [ { "_url": "https://example.com/api/v2/users/1/", "alternate_e...
[ "Parse", "identities", "using", "Mozillians", "format", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/mozilla.py#L84-L160
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/organizations.py
Organizations.run
def run(self, *args): """List, add or delete organizations and domains from the registry. By default, it prints the list of organizations available on the registry. """ params = self.parser.parse_args(args) organization = params.organization domain = params.doma...
python
def run(self, *args): """List, add or delete organizations and domains from the registry. By default, it prints the list of organizations available on the registry. """ params = self.parser.parse_args(args) organization = params.organization domain = params.doma...
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "params", "=", "self", ".", "parser", ".", "parse_args", "(", "args", ")", "organization", "=", "params", ".", "organization", "domain", "=", "params", ".", "domain", "is_top_domain", "=", "params", ...
List, add or delete organizations and domains from the registry. By default, it prints the list of organizations available on the registry.
[ "List", "add", "or", "delete", "organizations", "and", "domains", "from", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/organizations.py#L110-L131
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/organizations.py
Organizations.add
def add(self, organization, domain=None, is_top_domain=False, overwrite=False): """Add organizations and domains to the registry. This method adds the given 'organization' or 'domain' to the registry, but not both at the same time. When 'organization' is the only parameter given, it wi...
python
def add(self, organization, domain=None, is_top_domain=False, overwrite=False): """Add organizations and domains to the registry. This method adds the given 'organization' or 'domain' to the registry, but not both at the same time. When 'organization' is the only parameter given, it wi...
[ "def", "add", "(", "self", ",", "organization", ",", "domain", "=", "None", ",", "is_top_domain", "=", "False", ",", "overwrite", "=", "False", ")", ":", "if", "not", "organization", ":", "return", "CMD_SUCCESS", "if", "not", "domain", ":", "try", ":", ...
Add organizations and domains to the registry. This method adds the given 'organization' or 'domain' to the registry, but not both at the same time. When 'organization' is the only parameter given, it will be added to the registry. When 'domain' parameter is also given, the function wi...
[ "Add", "organizations", "and", "domains", "to", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/organizations.py#L133-L189
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/organizations.py
Organizations.delete
def delete(self, organization, domain=None): """Remove organizations and domains from the registry. The method removes the given 'organization' or 'domain' from the registry, but not both at the same time. When 'organization' is the only parameter given, it will be removed from ...
python
def delete(self, organization, domain=None): """Remove organizations and domains from the registry. The method removes the given 'organization' or 'domain' from the registry, but not both at the same time. When 'organization' is the only parameter given, it will be removed from ...
[ "def", "delete", "(", "self", ",", "organization", ",", "domain", "=", "None", ")", ":", "if", "not", "organization", ":", "return", "CMD_SUCCESS", "if", "not", "domain", ":", "try", ":", "api", ".", "delete_organization", "(", "self", ".", "db", ",", ...
Remove organizations and domains from the registry. The method removes the given 'organization' or 'domain' from the registry, but not both at the same time. When 'organization' is the only parameter given, it will be removed from the registry, including those domains related to it. Wh...
[ "Remove", "organizations", "and", "domains", "from", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/organizations.py#L191-L221
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/organizations.py
Organizations.registry
def registry(self, term=None): """List organizations and domains. When no term is given, the method will list the organizations existing in the registry. If 'term' is set, the method will list only those organizations and domains that match with that term. :param term: term to ...
python
def registry(self, term=None): """List organizations and domains. When no term is given, the method will list the organizations existing in the registry. If 'term' is set, the method will list only those organizations and domains that match with that term. :param term: term to ...
[ "def", "registry", "(", "self", ",", "term", "=", "None", ")", ":", "try", ":", "orgs", "=", "api", ".", "registry", "(", "self", ".", "db", ",", "term", ")", "self", ".", "display", "(", "'organizations.tmpl'", ",", "organizations", "=", "orgs", ")"...
List organizations and domains. When no term is given, the method will list the organizations existing in the registry. If 'term' is set, the method will list only those organizations and domains that match with that term. :param term: term to match
[ "List", "organizations", "and", "domains", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/organizations.py#L223-L239
train
chaoss/grimoirelab-sortinghat
sortinghat/parser.py
create_organizations_parser
def create_organizations_parser(stream): """Create an organizations parser for the given stream. Factory function that creates an organizations parser for the given stream. The stream is only used to guess the type of the required parser. :param stream: stream used to guess the type of the parser ...
python
def create_organizations_parser(stream): """Create an organizations parser for the given stream. Factory function that creates an organizations parser for the given stream. The stream is only used to guess the type of the required parser. :param stream: stream used to guess the type of the parser ...
[ "def", "create_organizations_parser", "(", "stream", ")", ":", "import", "sortinghat", ".", "parsing", "as", "parsing", "for", "p", "in", "parsing", ".", "SORTINGHAT_ORGS_PARSERS", ":", "klass", "=", "parsing", ".", "SORTINGHAT_ORGS_PARSERS", "[", "p", "]", "par...
Create an organizations parser for the given stream. Factory function that creates an organizations parser for the given stream. The stream is only used to guess the type of the required parser. :param stream: stream used to guess the type of the parser :returns: an organizations parser :rai...
[ "Create", "an", "organizations", "parser", "for", "the", "given", "stream", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parser.py#L44-L68
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/enroll.py
Enroll.enroll
def enroll(self, uuid, organization, from_date=MIN_PERIOD_DATE, to_date=MAX_PERIOD_DATE, merge=False): """Enroll a unique identity in an organization. This method adds a new relationship between the unique identity, identified by <uuid>, and <organization>. Both entities must exi...
python
def enroll(self, uuid, organization, from_date=MIN_PERIOD_DATE, to_date=MAX_PERIOD_DATE, merge=False): """Enroll a unique identity in an organization. This method adds a new relationship between the unique identity, identified by <uuid>, and <organization>. Both entities must exi...
[ "def", "enroll", "(", "self", ",", "uuid", ",", "organization", ",", "from_date", "=", "MIN_PERIOD_DATE", ",", "to_date", "=", "MAX_PERIOD_DATE", ",", "merge", "=", "False", ")", ":", "if", "not", "uuid", "or", "not", "organization", ":", "return", "CMD_SU...
Enroll a unique identity in an organization. This method adds a new relationship between the unique identity, identified by <uuid>, and <organization>. Both entities must exist on the registry before creating the new enrollment. The period of the enrollment can be given with the parame...
[ "Enroll", "a", "unique", "identity", "in", "an", "organization", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/enroll.py#L110-L165
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/eclipse.py
EclipseParser.__parse_identities
def __parse_identities(self, json): """Parse identities using Eclipse format. The Eclipse identities format is a JSON document under the "commiters" key. The document should follow the next schema: { 'committers' : { 'john': { 'affiliations': {...
python
def __parse_identities(self, json): """Parse identities using Eclipse format. The Eclipse identities format is a JSON document under the "commiters" key. The document should follow the next schema: { 'committers' : { 'john': { 'affiliations': {...
[ "def", "__parse_identities", "(", "self", ",", "json", ")", ":", "try", ":", "for", "committer", "in", "json", "[", "'committers'", "]", ".", "values", "(", ")", ":", "name", "=", "self", ".", "__encode", "(", "committer", "[", "'first'", "]", "+", "...
Parse identities using Eclipse format. The Eclipse identities format is a JSON document under the "commiters" key. The document should follow the next schema: { 'committers' : { 'john': { 'affiliations': { '1': { ...
[ "Parse", "identities", "using", "Eclipse", "format", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/eclipse.py#L83-L147
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/eclipse.py
EclipseParser.__parse_organizations
def __parse_organizations(self, json): """Parse Eclipse organizations. The Eclipse organizations format is a JSON document stored under the "organizations" key. The next JSON shows the structure of the document: { 'organizations' : { '1': { ...
python
def __parse_organizations(self, json): """Parse Eclipse organizations. The Eclipse organizations format is a JSON document stored under the "organizations" key. The next JSON shows the structure of the document: { 'organizations' : { '1': { ...
[ "def", "__parse_organizations", "(", "self", ",", "json", ")", ":", "try", ":", "for", "organization", "in", "json", "[", "'organizations'", "]", ".", "values", "(", ")", ":", "name", "=", "self", ".", "__encode", "(", "organization", "[", "'name'", "]",...
Parse Eclipse organizations. The Eclipse organizations format is a JSON document stored under the "organizations" key. The next JSON shows the structure of the document: { 'organizations' : { '1': { 'active': '2001-01-01 18:00:00', ...
[ "Parse", "Eclipse", "organizations", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/eclipse.py#L149-L215
train
chaoss/grimoirelab-sortinghat
sortinghat/parsing/eclipse.py
EclipseParser.__parse_affiliations_json
def __parse_affiliations_json(self, affiliations, uuid): """Parse identity's affiliations from a json dict""" enrollments = [] for affiliation in affiliations.values(): name = self.__encode(affiliation['name']) try: start_date = str_to_datetime(affiliat...
python
def __parse_affiliations_json(self, affiliations, uuid): """Parse identity's affiliations from a json dict""" enrollments = [] for affiliation in affiliations.values(): name = self.__encode(affiliation['name']) try: start_date = str_to_datetime(affiliat...
[ "def", "__parse_affiliations_json", "(", "self", ",", "affiliations", ",", "uuid", ")", ":", "enrollments", "=", "[", "]", "for", "affiliation", "in", "affiliations", ".", "values", "(", ")", ":", "name", "=", "self", ".", "__encode", "(", "affiliation", "...
Parse identity's affiliations from a json dict
[ "Parse", "identity", "s", "affiliations", "from", "a", "json", "dict" ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/parsing/eclipse.py#L217-L256
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
add_unique_identity
def add_unique_identity(db, uuid): """Add a unique identity to the registry. This function adds a unique identity to the registry. First, it checks if the unique identifier (uuid) used to create the identity is already on the registry. When it is not found, a new unique identity is created. Otherwi...
python
def add_unique_identity(db, uuid): """Add a unique identity to the registry. This function adds a unique identity to the registry. First, it checks if the unique identifier (uuid) used to create the identity is already on the registry. When it is not found, a new unique identity is created. Otherwi...
[ "def", "add_unique_identity", "(", "db", ",", "uuid", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "try", ":", "add_unique_identity_db", "(", "session", ",", "uuid", ")", "except", "ValueError", "as", "e", ":", "raise", "Invali...
Add a unique identity to the registry. This function adds a unique identity to the registry. First, it checks if the unique identifier (uuid) used to create the identity is already on the registry. When it is not found, a new unique identity is created. Otherwise, it raises a 'AlreadyExistError' except...
[ "Add", "a", "unique", "identity", "to", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L54-L73
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
add_organization
def add_organization(db, organization): """Add an organization to the registry. This function adds an organization to the registry. It checks first whether the organization is already on the registry. When it is not found, the new organization is added. Otherwise, it raises a 'AlreadyExistsError' e...
python
def add_organization(db, organization): """Add an organization to the registry. This function adds an organization to the registry. It checks first whether the organization is already on the registry. When it is not found, the new organization is added. Otherwise, it raises a 'AlreadyExistsError' e...
[ "def", "add_organization", "(", "db", ",", "organization", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "try", ":", "add_organization_db", "(", "session", ",", "organization", ")", "except", "ValueError", "as", "e", ":", "raise",...
Add an organization to the registry. This function adds an organization to the registry. It checks first whether the organization is already on the registry. When it is not found, the new organization is added. Otherwise, it raises a 'AlreadyExistsError' exception to notify that the organization al...
[ "Add", "an", "organization", "to", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L140-L160
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
add_domain
def add_domain(db, organization, domain, is_top_domain=False, overwrite=False): """Add a domain to the registry. This function adds a new domain to the given organization. The organization must exists on the registry prior to insert the new domain. Otherwise, it will raise a 'NotFoundError' exception. ...
python
def add_domain(db, organization, domain, is_top_domain=False, overwrite=False): """Add a domain to the registry. This function adds a new domain to the given organization. The organization must exists on the registry prior to insert the new domain. Otherwise, it will raise a 'NotFoundError' exception. ...
[ "def", "add_domain", "(", "db", ",", "organization", ",", "domain", ",", "is_top_domain", "=", "False", ",", "overwrite", "=", "False", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "org", "=", "find_organization", "(", "session...
Add a domain to the registry. This function adds a new domain to the given organization. The organization must exists on the registry prior to insert the new domain. Otherwise, it will raise a 'NotFoundError' exception. Moreover, if the given domain is already in the registry an 'AlreadyExistsError' ...
[ "Add", "a", "domain", "to", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L163-L215
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
add_to_matching_blacklist
def add_to_matching_blacklist(db, entity): """Add entity to the matching blacklist. This function adds an 'entity' o term to the matching blacklist. The term to add cannot have a None or empty value, in this case a InvalidValueError will be raised. If the given 'entity' exists in the registry, the ...
python
def add_to_matching_blacklist(db, entity): """Add entity to the matching blacklist. This function adds an 'entity' o term to the matching blacklist. The term to add cannot have a None or empty value, in this case a InvalidValueError will be raised. If the given 'entity' exists in the registry, the ...
[ "def", "add_to_matching_blacklist", "(", "db", ",", "entity", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "try", ":", "add_to_matching_blacklist_db", "(", "session", ",", "entity", ")", "except", "ValueError", "as", "e", ":", "r...
Add entity to the matching blacklist. This function adds an 'entity' o term to the matching blacklist. The term to add cannot have a None or empty value, in this case a InvalidValueError will be raised. If the given 'entity' exists in the registry, the function will raise an AlreadyExistsError exceptio...
[ "Add", "entity", "to", "the", "matching", "blacklist", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L279-L298
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
delete_unique_identity
def delete_unique_identity(db, uuid): """Remove a unique identity from the registry. Function that removes from the registry, the unique identity that matches with uuid. Data related to this identity will be also removed. It checks first whether the unique identity is already on the registry. ...
python
def delete_unique_identity(db, uuid): """Remove a unique identity from the registry. Function that removes from the registry, the unique identity that matches with uuid. Data related to this identity will be also removed. It checks first whether the unique identity is already on the registry. ...
[ "def", "delete_unique_identity", "(", "db", ",", "uuid", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "uidentity", "=", "find_unique_identity", "(", "session", ",", "uuid", ")", "if", "not", "uidentity", ":", "raise", "NotFoundEr...
Remove a unique identity from the registry. Function that removes from the registry, the unique identity that matches with uuid. Data related to this identity will be also removed. It checks first whether the unique identity is already on the registry. When it is found, the unique identity is remo...
[ "Remove", "a", "unique", "identity", "from", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L339-L363
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
delete_from_matching_blacklist
def delete_from_matching_blacklist(db, entity): """Remove an blacklisted entity from the registry. This function removes the given blacklisted entity from the registry. It checks first whether the excluded entity is already on the registry. When it is found, the entity is removed. Otherwise, it will ra...
python
def delete_from_matching_blacklist(db, entity): """Remove an blacklisted entity from the registry. This function removes the given blacklisted entity from the registry. It checks first whether the excluded entity is already on the registry. When it is found, the entity is removed. Otherwise, it will ra...
[ "def", "delete_from_matching_blacklist", "(", "db", ",", "entity", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "mb", "=", "session", ".", "query", "(", "MatchingBlacklist", ")", ".", "filter", "(", "MatchingBlacklist", ".", "exc...
Remove an blacklisted entity from the registry. This function removes the given blacklisted entity from the registry. It checks first whether the excluded entity is already on the registry. When it is found, the entity is removed. Otherwise, it will raise a 'NotFoundError'. :param db: database man...
[ "Remove", "an", "blacklisted", "entity", "from", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L509-L530
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
merge_enrollments
def merge_enrollments(db, uuid, organization): """Merge overlapping enrollments. This function merges those enrollments, related to the given 'uuid' and 'organization', that have overlapping dates. Default start and end dates (1900-01-01 and 2100-01-01) are considered range limits and will be remov...
python
def merge_enrollments(db, uuid, organization): """Merge overlapping enrollments. This function merges those enrollments, related to the given 'uuid' and 'organization', that have overlapping dates. Default start and end dates (1900-01-01 and 2100-01-01) are considered range limits and will be remov...
[ "def", "merge_enrollments", "(", "db", ",", "uuid", ",", "organization", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "uidentity", "=", "find_unique_identity", "(", "session", ",", "uuid", ")", "if", "not", "uidentity", ":", "r...
Merge overlapping enrollments. This function merges those enrollments, related to the given 'uuid' and 'organization', that have overlapping dates. Default start and end dates (1900-01-01 and 2100-01-01) are considered range limits and will be removed when a set of ranges overlap. For example: * ...
[ "Merge", "overlapping", "enrollments", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L632-L703
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
match_identities
def match_identities(db, uuid, matcher): """Search for similar unique identities. The function will search in the registry for similar identities to 'uuid'. The result will be a list matches containing unique identities objects. This list will not(!) include the given unique identity. The criteria...
python
def match_identities(db, uuid, matcher): """Search for similar unique identities. The function will search in the registry for similar identities to 'uuid'. The result will be a list matches containing unique identities objects. This list will not(!) include the given unique identity. The criteria...
[ "def", "match_identities", "(", "db", ",", "uuid", ",", "matcher", ")", ":", "uidentities", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "uidentity", "=", "find_unique_identity", "(", "session", ",", "uuid", ")", "if", "...
Search for similar unique identities. The function will search in the registry for similar identities to 'uuid'. The result will be a list matches containing unique identities objects. This list will not(!) include the given unique identity. The criteria used to check when an identity matches with ano...
[ "Search", "for", "similar", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L745-L786
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
unique_identities
def unique_identities(db, uuid=None, source=None): """List the unique identities available in the registry. The function returns a list of unique identities. When 'uuid' parameter is set, it will only return the information related to the unique identity identified by 'uuid'. When 'source' is given...
python
def unique_identities(db, uuid=None, source=None): """List the unique identities available in the registry. The function returns a list of unique identities. When 'uuid' parameter is set, it will only return the information related to the unique identity identified by 'uuid'. When 'source' is given...
[ "def", "unique_identities", "(", "db", ",", "uuid", "=", "None", ",", "source", "=", "None", ")", ":", "uidentities", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "query", "=", "session", ".", "query", "(", "UniqueIden...
List the unique identities available in the registry. The function returns a list of unique identities. When 'uuid' parameter is set, it will only return the information related to the unique identity identified by 'uuid'. When 'source' is given, only thouse unique identities with one or more identitie...
[ "List", "the", "unique", "identities", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L789-L833
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
search_unique_identities
def search_unique_identities(db, term, source=None): """Look for unique identities. This function returns those unique identities which match with the given 'term'. The term will be compated with name, email, username and source values of each identity. When `source` is given, this search will be o...
python
def search_unique_identities(db, term, source=None): """Look for unique identities. This function returns those unique identities which match with the given 'term'. The term will be compated with name, email, username and source values of each identity. When `source` is given, this search will be o...
[ "def", "search_unique_identities", "(", "db", ",", "term", ",", "source", "=", "None", ")", ":", "uidentities", "=", "[", "]", "pattern", "=", "'%'", "+", "term", "+", "'%'", "if", "term", "else", "None", "with", "db", ".", "connect", "(", ")", "as",...
Look for unique identities. This function returns those unique identities which match with the given 'term'. The term will be compated with name, email, username and source values of each identity. When `source` is given, this search will be only performed on identities linked to this source. :par...
[ "Look", "for", "unique", "identities", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L836-L881
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
search_unique_identities_slice
def search_unique_identities_slice(db, term, offset, limit): """Look for unique identities using slicing. This function returns those unique identities which match with the given `term`. The term will be compared with name, email, username and source values of each identity. When an empty term is given...
python
def search_unique_identities_slice(db, term, offset, limit): """Look for unique identities using slicing. This function returns those unique identities which match with the given `term`. The term will be compared with name, email, username and source values of each identity. When an empty term is given...
[ "def", "search_unique_identities_slice", "(", "db", ",", "term", ",", "offset", ",", "limit", ")", ":", "uidentities", "=", "[", "]", "pattern", "=", "'%'", "+", "term", "+", "'%'", "if", "term", "else", "None", "if", "offset", "<", "0", ":", "raise", ...
Look for unique identities using slicing. This function returns those unique identities which match with the given `term`. The term will be compared with name, email, username and source values of each identity. When an empty term is given, all unique identities will be returned. The results are limite...
[ "Look", "for", "unique", "identities", "using", "slicing", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L884-L939
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
search_last_modified_identities
def search_last_modified_identities(db, after): """Look for the uuids of identities modified on or after a given date. This function returns the uuids of identities modified on the given date or after it. The result is a list of uuids identities. :param db: database manager :param after: look ...
python
def search_last_modified_identities(db, after): """Look for the uuids of identities modified on or after a given date. This function returns the uuids of identities modified on the given date or after it. The result is a list of uuids identities. :param db: database manager :param after: look ...
[ "def", "search_last_modified_identities", "(", "db", ",", "after", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "query", "=", "session", ".", "query", "(", "Identity", ".", "id", ")", ".", "filter", "(", "Identity", ".", "las...
Look for the uuids of identities modified on or after a given date. This function returns the uuids of identities modified on the given date or after it. The result is a list of uuids identities. :param db: database manager :param after: look for identities modified on or after this date :ret...
[ "Look", "for", "the", "uuids", "of", "identities", "modified", "on", "or", "after", "a", "given", "date", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L942-L959
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
search_last_modified_unique_identities
def search_last_modified_unique_identities(db, after): """Look for the uuids of unique identities modified on or after a given date. This function returns the uuids of unique identities modified on the given date or after it. The result is a list of uuids unique identities. :param db: database...
python
def search_last_modified_unique_identities(db, after): """Look for the uuids of unique identities modified on or after a given date. This function returns the uuids of unique identities modified on the given date or after it. The result is a list of uuids unique identities. :param db: database...
[ "def", "search_last_modified_unique_identities", "(", "db", ",", "after", ")", ":", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "query", "=", "session", ".", "query", "(", "UniqueIdentity", ".", "uuid", ")", ".", "filter", "(", "UniqueIde...
Look for the uuids of unique identities modified on or after a given date. This function returns the uuids of unique identities modified on the given date or after it. The result is a list of uuids unique identities. :param db: database manager :param after: look for identities modified on or ...
[ "Look", "for", "the", "uuids", "of", "unique", "identities", "modified", "on", "or", "after", "a", "given", "date", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L962-L980
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
search_profiles
def search_profiles(db, no_gender=False): """List unique identities profiles. The function will return the list of profiles filtered by the given parameters. When `no_gender` is set, only profiles without gender values will be returned. :param db: database manager :param no_gender: return only...
python
def search_profiles(db, no_gender=False): """List unique identities profiles. The function will return the list of profiles filtered by the given parameters. When `no_gender` is set, only profiles without gender values will be returned. :param db: database manager :param no_gender: return only...
[ "def", "search_profiles", "(", "db", ",", "no_gender", "=", "False", ")", ":", "profiles", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "query", "=", "session", ".", "query", "(", "Profile", ")", "if", "no_gender", ":"...
List unique identities profiles. The function will return the list of profiles filtered by the given parameters. When `no_gender` is set, only profiles without gender values will be returned. :param db: database manager :param no_gender: return only those profiles without gender :returns: a l...
[ "List", "unique", "identities", "profiles", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L983-L1008
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
registry
def registry(db, term=None): """List the organizations available in the registry. The function will return the list of organizations. If term parameter is set, it will only return the information about the organizations which match that term. When the given term does not match with any organization...
python
def registry(db, term=None): """List the organizations available in the registry. The function will return the list of organizations. If term parameter is set, it will only return the information about the organizations which match that term. When the given term does not match with any organization...
[ "def", "registry", "(", "db", ",", "term", "=", "None", ")", ":", "orgs", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "if", "term", ":", "orgs", "=", "session", ".", "query", "(", "Organization", ")", ".", "filter...
List the organizations available in the registry. The function will return the list of organizations. If term parameter is set, it will only return the information about the organizations which match that term. When the given term does not match with any organization from the registry a 'NotFounError' ...
[ "List", "the", "organizations", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L1011-L1045
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
domains
def domains(db, domain=None, top=False): """List the domains available in the registry. The function will return the list of domains. Settting the top flag, it will look for those domains that are top domains. If domain parameter is set, it will only return the information about that domain. When ...
python
def domains(db, domain=None, top=False): """List the domains available in the registry. The function will return the list of domains. Settting the top flag, it will look for those domains that are top domains. If domain parameter is set, it will only return the information about that domain. When ...
[ "def", "domains", "(", "db", ",", "domain", "=", "None", ",", "top", "=", "False", ")", ":", "doms", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "if", "domain", ":", "dom", "=", "find_domain", "(", "session", ",",...
List the domains available in the registry. The function will return the list of domains. Settting the top flag, it will look for those domains that are top domains. If domain parameter is set, it will only return the information about that domain. When both paramaters are set, it will first search fo...
[ "List", "the", "domains", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L1048-L1107
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
countries
def countries(db, code=None, term=None): """List the countries available in the registry. The function will return the list of countries. When either 'code' or 'term' parameters are set, it will only return the information about those countries that match them. Take into account that 'code' is a c...
python
def countries(db, code=None, term=None): """List the countries available in the registry. The function will return the list of countries. When either 'code' or 'term' parameters are set, it will only return the information about those countries that match them. Take into account that 'code' is a c...
[ "def", "countries", "(", "db", ",", "code", "=", "None", ",", "term", "=", "None", ")", ":", "def", "_is_code_valid", "(", "code", ")", ":", "return", "type", "(", "code", ")", "==", "str", "and", "len", "(", "code", ")", "==", "2", "and", "code"...
List the countries available in the registry. The function will return the list of countries. When either 'code' or 'term' parameters are set, it will only return the information about those countries that match them. Take into account that 'code' is a country identifier composed by two letters (i...
[ "List", "the", "countries", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L1110-L1169
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
enrollments
def enrollments(db, uuid=None, organization=None, from_date=None, to_date=None): """List the enrollment information available in the registry. This function will return a list of enrollments. If 'uuid' parameter is set, it will return the enrollments related to that unique identity; if 'organization' p...
python
def enrollments(db, uuid=None, organization=None, from_date=None, to_date=None): """List the enrollment information available in the registry. This function will return a list of enrollments. If 'uuid' parameter is set, it will return the enrollments related to that unique identity; if 'organization' p...
[ "def", "enrollments", "(", "db", ",", "uuid", "=", "None", ",", "organization", "=", "None", ",", "from_date", "=", "None", ",", "to_date", "=", "None", ")", ":", "if", "not", "from_date", ":", "from_date", "=", "MIN_PERIOD_DATE", "if", "not", "to_date",...
List the enrollment information available in the registry. This function will return a list of enrollments. If 'uuid' parameter is set, it will return the enrollments related to that unique identity; if 'organization' parameter is given, it will return the enrollments related to that organization; if b...
[ "List", "the", "enrollment", "information", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L1172-L1253
train
chaoss/grimoirelab-sortinghat
sortinghat/api.py
blacklist
def blacklist(db, term=None): """List the blacklisted entities available in the registry. The function will return the list of blacklisted entities. If term parameter is set, it will only return the information about the entities which match that term. When the given term does not match with any en...
python
def blacklist(db, term=None): """List the blacklisted entities available in the registry. The function will return the list of blacklisted entities. If term parameter is set, it will only return the information about the entities which match that term. When the given term does not match with any en...
[ "def", "blacklist", "(", "db", ",", "term", "=", "None", ")", ":", "mbs", "=", "[", "]", "with", "db", ".", "connect", "(", ")", "as", "session", ":", "if", "term", ":", "mbs", "=", "session", ".", "query", "(", "MatchingBlacklist", ")", ".", "fi...
List the blacklisted entities available in the registry. The function will return the list of blacklisted entities. If term parameter is set, it will only return the information about the entities which match that term. When the given term does not match with any entry on the blacklist a 'NotFoundError...
[ "List", "the", "blacklisted", "entities", "available", "in", "the", "registry", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/api.py#L1256-L1290
train
chaoss/grimoirelab-sortinghat
sortinghat/cmd/profile.py
Profile.run
def run(self, *args): """Endit profile information.""" uuid, kwargs = self.__parse_arguments(*args) code = self.edit_profile(uuid, **kwargs) return code
python
def run(self, *args): """Endit profile information.""" uuid, kwargs = self.__parse_arguments(*args) code = self.edit_profile(uuid, **kwargs) return code
[ "def", "run", "(", "self", ",", "*", "args", ")", ":", "uuid", ",", "kwargs", "=", "self", ".", "__parse_arguments", "(", "*", "args", ")", "code", "=", "self", ".", "edit_profile", "(", "uuid", ",", "**", "kwargs", ")", "return", "code" ]
Endit profile information.
[ "Endit", "profile", "information", "." ]
391cd37a75fea26311dc6908bc1c953c540a8e04
https://github.com/chaoss/grimoirelab-sortinghat/blob/391cd37a75fea26311dc6908bc1c953c540a8e04/sortinghat/cmd/profile.py#L89-L95
train