repository_name
stringlengths
7
55
func_path_in_repository
stringlengths
4
223
func_name
stringlengths
1
134
whole_func_string
stringlengths
75
104k
language
stringclasses
1 value
func_code_string
stringlengths
75
104k
func_code_tokens
listlengths
19
28.4k
func_documentation_string
stringlengths
1
46.9k
func_documentation_tokens
listlengths
1
1.97k
split_name
stringclasses
1 value
func_code_url
stringlengths
87
315
qubell/contrib-python-qubell-client
qubell/api/tools/__init__.py
patch_env
def patch_env(env, path, value): """ Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777 """ def pathGet(dictionary, path): for item in path.split("/"): ...
python
def patch_env(env, path, value): """ Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777 """ def pathGet(dictionary, path): for item in path.split("/"): ...
[ "def", "patch_env", "(", "env", ",", "path", ",", "value", ")", ":", "def", "pathGet", "(", "dictionary", ",", "path", ")", ":", "for", "item", "in", "path", ".", "split", "(", "\"/\"", ")", ":", "dictionary", "=", "dictionary", "[", "item", "]", "...
Set specified value to yaml path. Example: patch('application/components/child/configuration/__locator.application-id','777') Will change child app ID to 777
[ "Set", "specified", "value", "to", "yaml", "path", ".", "Example", ":", "patch", "(", "application", "/", "components", "/", "child", "/", "configuration", "/", "__locator", ".", "application", "-", "id", "777", ")", "Will", "change", "child", "app", "ID",...
train
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/tools/__init__.py#L248-L266
qubell/contrib-python-qubell-client
qubell/api/tools/__init__.py
get_starter_kit_meta
def get_starter_kit_meta(name): """ Extract metadata link for starter kit from platform configs. Starter kit available on add component - starter kit menu. Beware, config could be changed by deploy scripts during deploy. :param name: Name of starter kit :return: Link to metadata """ kits = y...
python
def get_starter_kit_meta(name): """ Extract metadata link for starter kit from platform configs. Starter kit available on add component - starter kit menu. Beware, config could be changed by deploy scripts during deploy. :param name: Name of starter kit :return: Link to metadata """ kits = y...
[ "def", "get_starter_kit_meta", "(", "name", ")", ":", "kits", "=", "yaml", ".", "safe_load", "(", "requests", ".", "get", "(", "url", "=", "starter_kits_url", ")", ".", "content", ")", "[", "'kits'", "]", "kits_meta_url", "=", "[", "x", "[", "'metaUrl'",...
Extract metadata link for starter kit from platform configs. Starter kit available on add component - starter kit menu. Beware, config could be changed by deploy scripts during deploy. :param name: Name of starter kit :return: Link to metadata
[ "Extract", "metadata", "link", "for", "starter", "kit", "from", "platform", "configs", ".", "Starter", "kit", "available", "on", "add", "component", "-", "starter", "kit", "menu", ".", "Beware", "config", "could", "be", "changed", "by", "deploy", "scripts", ...
train
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/tools/__init__.py#L298-L310
qubell/contrib-python-qubell-client
qubell/api/tools/__init__.py
get_manifest_from_meta
def get_manifest_from_meta(metaurl, name): """ Extact manifest url from metadata url :param metaurl: Url to metadata :param name: Name of application to extract :return: """ if 'http' in metaurl: kit = yaml.safe_load(requests.get(url=metaurl).content)['kit']['applications'] else:...
python
def get_manifest_from_meta(metaurl, name): """ Extact manifest url from metadata url :param metaurl: Url to metadata :param name: Name of application to extract :return: """ if 'http' in metaurl: kit = yaml.safe_load(requests.get(url=metaurl).content)['kit']['applications'] else:...
[ "def", "get_manifest_from_meta", "(", "metaurl", ",", "name", ")", ":", "if", "'http'", "in", "metaurl", ":", "kit", "=", "yaml", ".", "safe_load", "(", "requests", ".", "get", "(", "url", "=", "metaurl", ")", ".", "content", ")", "[", "'kit'", "]", ...
Extact manifest url from metadata url :param metaurl: Url to metadata :param name: Name of application to extract :return:
[ "Extact", "manifest", "url", "from", "metadata", "url", ":", "param", "metaurl", ":", "Url", "to", "metadata", ":", "param", "name", ":", "Name", "of", "application", "to", "extract", ":", "return", ":" ]
train
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/qubell/api/tools/__init__.py#L312-L325
davidblaisonneau-orange/foreman
foreman/subItem.py
SubItem.getPayloadStruct
def getPayloadStruct(self, attributes, objType=None): """ Function getPayloadStruct Get the payload structure to do a creation or a modification @param key: The key to modify @param attribute: The data @param objType: NOT USED in this class @return RETURN: The API result...
python
def getPayloadStruct(self, attributes, objType=None): """ Function getPayloadStruct Get the payload structure to do a creation or a modification @param key: The key to modify @param attribute: The data @param objType: NOT USED in this class @return RETURN: The API result...
[ "def", "getPayloadStruct", "(", "self", ",", "attributes", ",", "objType", "=", "None", ")", ":", "if", "self", ".", "setInParentPayload", ":", "return", "{", "self", ".", "parentPayloadObject", ":", "{", "self", ".", "payloadObj", ":", "attributes", "}", ...
Function getPayloadStruct Get the payload structure to do a creation or a modification @param key: The key to modify @param attribute: The data @param objType: NOT USED in this class @return RETURN: The API result
[ "Function", "getPayloadStruct", "Get", "the", "payload", "structure", "to", "do", "a", "creation", "or", "a", "modification" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/subItem.py#L50-L63
davidblaisonneau-orange/foreman
foreman/api.py
Api.log
def log(function): """ Function log Decorator to log lasts request before sending a new one @return RETURN: None """ def _log(self, *args, **kwargs): ret = function(self, *args, **kwargs) if len(self.history) > self.maxHistory: self.histor...
python
def log(function): """ Function log Decorator to log lasts request before sending a new one @return RETURN: None """ def _log(self, *args, **kwargs): ret = function(self, *args, **kwargs) if len(self.history) > self.maxHistory: self.histor...
[ "def", "log", "(", "function", ")", ":", "def", "_log", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ret", "=", "function", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", "if", "len", "(", "self", ".", "his...
Function log Decorator to log lasts request before sending a new one @return RETURN: None
[ "Function", "log", "Decorator", "to", "log", "lasts", "request", "before", "sending", "a", "new", "one" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L50-L69
davidblaisonneau-orange/foreman
foreman/api.py
Api.clearReqVars
def clearReqVars(self): """ Function clearHistVars Clear the variables used to get history of all vars @return RETURN: None """ self.errorMsg = None self.payload = None self.url = None self.resp = None self.res = None self.method = None ...
python
def clearReqVars(self): """ Function clearHistVars Clear the variables used to get history of all vars @return RETURN: None """ self.errorMsg = None self.payload = None self.url = None self.resp = None self.res = None self.method = None ...
[ "def", "clearReqVars", "(", "self", ")", ":", "self", ".", "errorMsg", "=", "None", "self", ".", "payload", "=", "None", "self", ".", "url", "=", "None", "self", ".", "resp", "=", "None", "self", ".", "res", "=", "None", "self", ".", "method", "=",...
Function clearHistVars Clear the variables used to get history of all vars @return RETURN: None
[ "Function", "clearHistVars", "Clear", "the", "variables", "used", "to", "get", "history", "of", "all", "vars" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L71-L83
davidblaisonneau-orange/foreman
foreman/api.py
Api.list
def list(self, obj, filter=False, only_id=False, limit=20): """ Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RETURN: the li...
python
def list(self, obj, filter=False, only_id=False, limit=20): """ Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RETURN: the li...
[ "def", "list", "(", "self", ",", "obj", ",", "filter", "=", "False", ",", "only_id", "=", "False", ",", "limit", "=", "20", ")", ":", "self", ".", "url", "=", "'{}{}/?per_page={}'", ".", "format", "(", "self", ".", "base_url", ",", "obj", ",", "lim...
Function list Get the list of an object @param obj: object name ('hosts', 'puppetclasses'...) @param filter: filter for objects @param only_id: boolean to only return dict with name/id @return RETURN: the list of the object
[ "Function", "list", "Get", "the", "list", "of", "an", "object" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L86-L115
davidblaisonneau-orange/foreman
foreman/api.py
Api.get
def get(self, obj, id, sub_object=None): """ Function get Get an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object """ self.url = '{}{}/{}'.format(self.base_url, obj...
python
def get(self, obj, id, sub_object=None): """ Function get Get an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object """ self.url = '{}{}/{}'.format(self.base_url, obj...
[ "def", "get", "(", "self", ",", "obj", ",", "id", ",", "sub_object", "=", "None", ")", ":", "self", ".", "url", "=", "'{}{}/{}'", ".", "format", "(", "self", ".", "base_url", ",", "obj", ",", "id", ")", "self", ".", "method", "=", "'GET'", "if", ...
Function get Get an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object
[ "Function", "get", "Get", "an", "object", "by", "id" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L118-L134
davidblaisonneau-orange/foreman
foreman/api.py
Api.get_id_by_name
def get_id_by_name(self, obj, name): """ Function get_id_by_name Get the id of an object @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object """ list = self.list(obj, filter='name ...
python
def get_id_by_name(self, obj, name): """ Function get_id_by_name Get the id of an object @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object """ list = self.list(obj, filter='name ...
[ "def", "get_id_by_name", "(", "self", ",", "obj", ",", "name", ")", ":", "list", "=", "self", ".", "list", "(", "obj", ",", "filter", "=", "'name = \"{}\"'", ".", "format", "(", "name", ")", ",", "only_id", "=", "True", ",", "limit", "=", "1", ")",...
Function get_id_by_name Get the id of an object @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the targeted object
[ "Function", "get_id_by_name", "Get", "the", "id", "of", "an", "object" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L137-L147
davidblaisonneau-orange/foreman
foreman/api.py
Api.set
def set(self, obj, id, payload, action='', async=False): """ Function set Set an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @param action: specific action of an object ('power'...) @param payload: the d...
python
def set(self, obj, id, payload, action='', async=False): """ Function set Set an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @param action: specific action of an object ('power'...) @param payload: the d...
[ "def", "set", "(", "self", ",", "obj", ",", "id", ",", "payload", ",", "action", "=", "''", ",", "async", "=", "False", ")", ":", "self", ".", "url", "=", "'{}{}/{}'", ".", "format", "(", "self", ".", "base_url", ",", "obj", ",", "id", ")", "se...
Function set Set an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @param action: specific action of an object ('power'...) @param payload: the dict of the payload @param async: should this request be async...
[ "Function", "set", "Set", "an", "object", "by", "id" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L150-L178
davidblaisonneau-orange/foreman
foreman/api.py
Api.create
def create(self, obj, payload, async=False): """ Function create Create an new object @param obj: object name ('hosts', 'puppetclasses'...) @param payload: the dict of the payload @param async: should this request be async, if true use return.result() to ...
python
def create(self, obj, payload, async=False): """ Function create Create an new object @param obj: object name ('hosts', 'puppetclasses'...) @param payload: the dict of the payload @param async: should this request be async, if true use return.result() to ...
[ "def", "create", "(", "self", ",", "obj", ",", "payload", ",", "async", "=", "False", ")", ":", "self", ".", "url", "=", "self", ".", "base_url", "+", "obj", "self", ".", "method", "=", "'POST'", "self", ".", "payload", "=", "json", ".", "dumps", ...
Function create Create an new object @param obj: object name ('hosts', 'puppetclasses'...) @param payload: the dict of the payload @param async: should this request be async, if true use return.result() to get the response @return RETURN: the server respo...
[ "Function", "create", "Create", "an", "new", "object" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L181-L205
davidblaisonneau-orange/foreman
foreman/api.py
Api.delete
def delete(self, obj, id): """ Function delete Delete an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the server response """ self.url = '{}{}/{}'.format(self.base_url, obj, id) ...
python
def delete(self, obj, id): """ Function delete Delete an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the server response """ self.url = '{}{}/{}'.format(self.base_url, obj, id) ...
[ "def", "delete", "(", "self", ",", "obj", ",", "id", ")", ":", "self", ".", "url", "=", "'{}{}/{}'", ".", "format", "(", "self", ".", "base_url", ",", "obj", ",", "id", ")", "self", ".", "method", "=", "'DELETE'", "self", ".", "resp", "=", "reque...
Function delete Delete an object by id @param obj: object name ('hosts', 'puppetclasses'...) @param id: the id of the object (name or id) @return RETURN: the server response
[ "Function", "delete", "Delete", "an", "object", "by", "id" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/api.py#L208-L221
MatterMiners/cobald
cobald/daemon/runners/thread_runner.py
CapturingThread.run
def run(self): """Modified ``run`` that captures return value and exceptions from ``target``""" try: if self._target: return_value = self._target(*self._args, **self._kwargs) if return_value is not None: self._exception = OrphanedReturn(sel...
python
def run(self): """Modified ``run`` that captures return value and exceptions from ``target``""" try: if self._target: return_value = self._target(*self._args, **self._kwargs) if return_value is not None: self._exception = OrphanedReturn(sel...
[ "def", "run", "(", "self", ")", ":", "try", ":", "if", "self", ".", "_target", ":", "return_value", "=", "self", ".", "_target", "(", "*", "self", ".", "_args", ",", "*", "*", "self", ".", "_kwargs", ")", "if", "return_value", "is", "not", "None", ...
Modified ``run`` that captures return value and exceptions from ``target``
[ "Modified", "run", "that", "captures", "return", "value", "and", "exceptions", "from", "target" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L24-L36
MatterMiners/cobald
cobald/daemon/runners/thread_runner.py
ThreadRunner._start_payloads
def _start_payloads(self): """Start all queued payloads""" with self._lock: payloads = self._payloads.copy() self._payloads.clear() for subroutine in payloads: thread = CapturingThread(target=subroutine) thread.start() self._threads.add...
python
def _start_payloads(self): """Start all queued payloads""" with self._lock: payloads = self._payloads.copy() self._payloads.clear() for subroutine in payloads: thread = CapturingThread(target=subroutine) thread.start() self._threads.add...
[ "def", "_start_payloads", "(", "self", ")", ":", "with", "self", ".", "_lock", ":", "payloads", "=", "self", ".", "_payloads", ".", "copy", "(", ")", "self", ".", "_payloads", ".", "clear", "(", ")", "for", "subroutine", "in", "payloads", ":", "thread"...
Start all queued payloads
[ "Start", "all", "queued", "payloads" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L61-L71
MatterMiners/cobald
cobald/daemon/runners/thread_runner.py
ThreadRunner._reap_payloads
def _reap_payloads(self): """Clean up all finished payloads""" for thread in self._threads.copy(): # CapturingThread.join will throw if thread.join(timeout=0): self._threads.remove(thread) self._logger.debug('reaped thread %s', thread)
python
def _reap_payloads(self): """Clean up all finished payloads""" for thread in self._threads.copy(): # CapturingThread.join will throw if thread.join(timeout=0): self._threads.remove(thread) self._logger.debug('reaped thread %s', thread)
[ "def", "_reap_payloads", "(", "self", ")", ":", "for", "thread", "in", "self", ".", "_threads", ".", "copy", "(", ")", ":", "# CapturingThread.join will throw", "if", "thread", ".", "join", "(", "timeout", "=", "0", ")", ":", "self", ".", "_threads", "."...
Clean up all finished payloads
[ "Clean", "up", "all", "finished", "payloads" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/thread_runner.py#L73-L79
teaearlgraycold/puni
puni/decorators.py
update_cache
def update_cache(func): """Decorate functions that modify the internally stored usernotes JSON. Ensures that updates are mirrored onto reddit. Arguments: func: the function being decorated """ @wraps(func) def wrapper(self, *args, **kwargs): """The wrapper function.""" ...
python
def update_cache(func): """Decorate functions that modify the internally stored usernotes JSON. Ensures that updates are mirrored onto reddit. Arguments: func: the function being decorated """ @wraps(func) def wrapper(self, *args, **kwargs): """The wrapper function.""" ...
[ "def", "update_cache", "(", "func", ")", ":", "@", "wraps", "(", "func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "\"\"\"The wrapper function.\"\"\"", "lazy", "=", "kwargs", ".", "get", "(", "'lazy'", ","...
Decorate functions that modify the internally stored usernotes JSON. Ensures that updates are mirrored onto reddit. Arguments: func: the function being decorated
[ "Decorate", "functions", "that", "modify", "the", "internally", "stored", "usernotes", "JSON", "." ]
train
https://github.com/teaearlgraycold/puni/blob/f6d0bfde99942b29a6f91273e48abcd2d7a94c93/puni/decorators.py#L21-L46
MatterMiners/cobald
cobald/interfaces/_controller.py
Controller.s
def s(cls: Type[C], *args, **kwargs) -> Partial[C]: """ Create an unbound prototype of this class, partially applying arguments .. code:: python controller = Controller.s(interval=20) pipeline = controller(rate=10) >> pool """ return Partial(cls, *args,...
python
def s(cls: Type[C], *args, **kwargs) -> Partial[C]: """ Create an unbound prototype of this class, partially applying arguments .. code:: python controller = Controller.s(interval=20) pipeline = controller(rate=10) >> pool """ return Partial(cls, *args,...
[ "def", "s", "(", "cls", ":", "Type", "[", "C", "]", ",", "*", "args", ",", "*", "*", "kwargs", ")", "->", "Partial", "[", "C", "]", ":", "return", "Partial", "(", "cls", ",", "*", "args", ",", "*", "*", "kwargs", ")" ]
Create an unbound prototype of this class, partially applying arguments .. code:: python controller = Controller.s(interval=20) pipeline = controller(rate=10) >> pool
[ "Create", "an", "unbound", "prototype", "of", "this", "class", "partially", "applying", "arguments" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/interfaces/_controller.py#L21-L31
josiah-wolf-oberholtzer/uqbar
uqbar/apis/InheritanceGraph.py
InheritanceGraph._build_mappings
def _build_mappings( self, classes: Sequence[type] ) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]: """ Collect all bases and organize into parent/child mappings. """ parents_to_children: MutableMapping[type, Set[type]] = {} children_to_parent...
python
def _build_mappings( self, classes: Sequence[type] ) -> Tuple[Mapping[type, Sequence[type]], Mapping[type, Sequence[type]]]: """ Collect all bases and organize into parent/child mappings. """ parents_to_children: MutableMapping[type, Set[type]] = {} children_to_parent...
[ "def", "_build_mappings", "(", "self", ",", "classes", ":", "Sequence", "[", "type", "]", ")", "->", "Tuple", "[", "Mapping", "[", "type", ",", "Sequence", "[", "type", "]", "]", ",", "Mapping", "[", "type", ",", "Sequence", "[", "type", "]", "]", ...
Collect all bases and organize into parent/child mappings.
[ "Collect", "all", "bases", "and", "organize", "into", "parent", "/", "child", "mappings", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/apis/InheritanceGraph.py#L347-L385
josiah-wolf-oberholtzer/uqbar
uqbar/apis/InheritanceGraph.py
InheritanceGraph._collect_classes
def _collect_classes( self, package_paths: Sequence[str], recurse_subpackages: bool = True ) -> Sequence[type]: """ Collect all classes defined in/under ``package_paths``. """ import uqbar.apis classes = [] initial_source_paths: Set[str] = set() # Gra...
python
def _collect_classes( self, package_paths: Sequence[str], recurse_subpackages: bool = True ) -> Sequence[type]: """ Collect all classes defined in/under ``package_paths``. """ import uqbar.apis classes = [] initial_source_paths: Set[str] = set() # Gra...
[ "def", "_collect_classes", "(", "self", ",", "package_paths", ":", "Sequence", "[", "str", "]", ",", "recurse_subpackages", ":", "bool", "=", "True", ")", "->", "Sequence", "[", "type", "]", ":", "import", "uqbar", ".", "apis", "classes", "=", "[", "]", ...
Collect all classes defined in/under ``package_paths``.
[ "Collect", "all", "classes", "defined", "in", "/", "under", "package_paths", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/apis/InheritanceGraph.py#L387-L422
quantmind/agile-toolkit
agiletoolkit/api/__init__.py
get_auth
def get_auth(): """Return a tuple for authenticating a user If not successful raise ``AgileError``. """ auth = get_auth_from_env() if auth[0] and auth[1]: return auth home = os.path.expanduser("~") config = os.path.join(home, '.gitconfig') if not os.path.isfile(config): ...
python
def get_auth(): """Return a tuple for authenticating a user If not successful raise ``AgileError``. """ auth = get_auth_from_env() if auth[0] and auth[1]: return auth home = os.path.expanduser("~") config = os.path.join(home, '.gitconfig') if not os.path.isfile(config): ...
[ "def", "get_auth", "(", ")", ":", "auth", "=", "get_auth_from_env", "(", ")", "if", "auth", "[", "0", "]", "and", "auth", "[", "1", "]", ":", "return", "auth", "home", "=", "os", ".", "path", ".", "expanduser", "(", "\"~\"", ")", "config", "=", "...
Return a tuple for authenticating a user If not successful raise ``AgileError``.
[ "Return", "a", "tuple", "for", "authenticating", "a", "user" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/__init__.py#L40-L66
davidblaisonneau-orange/foreman
foreman/architectures.py
Architectures.checkAndCreate
def checkAndCreate(self, key, payload, osIds): """ Function checkAndCreate Check if an architectures exists and create it if not @param key: The targeted architectures @param payload: The targeted architectures description @param osIds: The list of os ids liked with this archite...
python
def checkAndCreate(self, key, payload, osIds): """ Function checkAndCreate Check if an architectures exists and create it if not @param key: The targeted architectures @param payload: The targeted architectures description @param osIds: The list of os ids liked with this archite...
[ "def", "checkAndCreate", "(", "self", ",", "key", ",", "payload", ",", "osIds", ")", ":", "if", "key", "not", "in", "self", ":", "self", "[", "key", "]", "=", "payload", "oid", "=", "self", "[", "key", "]", "[", "'id'", "]", "if", "not", "oid", ...
Function checkAndCreate Check if an architectures exists and create it if not @param key: The targeted architectures @param payload: The targeted architectures description @param osIds: The list of os ids liked with this architecture @return RETURN: The id of the object
[ "Function", "checkAndCreate", "Check", "if", "an", "architectures", "exists", "and", "create", "it", "if", "not" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/architectures.py#L29-L49
DataMedSci/mcpartools
setup.py
pip_command_output
def pip_command_output(pip_args): """ Get output (as a string) from pip command :param pip_args: list o pip switches to pass :return: string with results """ import sys import pip from io import StringIO # as pip will write to stdout we use some nasty hacks # to substitute system...
python
def pip_command_output(pip_args): """ Get output (as a string) from pip command :param pip_args: list o pip switches to pass :return: string with results """ import sys import pip from io import StringIO # as pip will write to stdout we use some nasty hacks # to substitute system...
[ "def", "pip_command_output", "(", "pip_args", ")", ":", "import", "sys", "import", "pip", "from", "io", "import", "StringIO", "# as pip will write to stdout we use some nasty hacks", "# to substitute system stdout with our own", "old_stdout", "=", "sys", ".", "stdout", "sys...
Get output (as a string) from pip command :param pip_args: list o pip switches to pass :return: string with results
[ "Get", "output", "(", "as", "a", "string", ")", "from", "pip", "command", ":", "param", "pip_args", ":", "list", "o", "pip", "switches", "to", "pass", ":", "return", ":", "string", "with", "results" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/setup.py#L5-L22
DataMedSci/mcpartools
setup.py
setup_versioneer
def setup_versioneer(): """ Generate (temporarily) versioneer.py file in project root directory :return: """ try: # assume versioneer.py was generated using "versioneer install" command import versioneer versioneer.get_version() except ImportError: # it looks vers...
python
def setup_versioneer(): """ Generate (temporarily) versioneer.py file in project root directory :return: """ try: # assume versioneer.py was generated using "versioneer install" command import versioneer versioneer.get_version() except ImportError: # it looks vers...
[ "def", "setup_versioneer", "(", ")", ":", "try", ":", "# assume versioneer.py was generated using \"versioneer install\" command", "import", "versioneer", "versioneer", ".", "get_version", "(", ")", "except", "ImportError", ":", "# it looks versioneer.py is missing", "# lets as...
Generate (temporarily) versioneer.py file in project root directory :return:
[ "Generate", "(", "temporarily", ")", "versioneer", ".", "py", "file", "in", "project", "root", "directory", ":", "return", ":" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/setup.py#L25-L67
DataMedSci/mcpartools
setup.py
clean_cache
def clean_cache(): """ Python won't realise that new module has appeared in the runtime We need to clean the cache of module finders. Hacking again :return: """ import importlib try: # Python ver < 3.3 vermod = importlib.import_module("versioneer") globals()["versioneer"] = ...
python
def clean_cache(): """ Python won't realise that new module has appeared in the runtime We need to clean the cache of module finders. Hacking again :return: """ import importlib try: # Python ver < 3.3 vermod = importlib.import_module("versioneer") globals()["versioneer"] = ...
[ "def", "clean_cache", "(", ")", ":", "import", "importlib", "try", ":", "# Python ver < 3.3", "vermod", "=", "importlib", ".", "import_module", "(", "\"versioneer\"", ")", "globals", "(", ")", "[", "\"versioneer\"", "]", "=", "vermod", "except", "ImportError", ...
Python won't realise that new module has appeared in the runtime We need to clean the cache of module finders. Hacking again :return:
[ "Python", "won", "t", "realise", "that", "new", "module", "has", "appeared", "in", "the", "runtime", "We", "need", "to", "clean", "the", "cache", "of", "module", "finders", ".", "Hacking", "again", ":", "return", ":" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/setup.py#L70-L81
DataMedSci/mcpartools
setup.py
get_version
def get_version(): """ Get project version (using versioneer) :return: string containing version """ setup_versioneer() clean_cache() import versioneer version = versioneer.get_version() parsed_version = parse_version(version) if '*@' in str(parsed_version): import time ...
python
def get_version(): """ Get project version (using versioneer) :return: string containing version """ setup_versioneer() clean_cache() import versioneer version = versioneer.get_version() parsed_version = parse_version(version) if '*@' in str(parsed_version): import time ...
[ "def", "get_version", "(", ")", ":", "setup_versioneer", "(", ")", "clean_cache", "(", ")", "import", "versioneer", "version", "=", "versioneer", ".", "get_version", "(", ")", "parsed_version", "=", "parse_version", "(", "version", ")", "if", "'*@'", "in", "...
Get project version (using versioneer) :return: string containing version
[ "Get", "project", "version", "(", "using", "versioneer", ")", ":", "return", ":", "string", "containing", "version" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/setup.py#L84-L97
josiah-wolf-oberholtzer/uqbar
uqbar/io/__init__.py
find_common_prefix
def find_common_prefix( paths: Sequence[Union[str, pathlib.Path]] ) -> Optional[pathlib.Path]: """ Find the common prefix of two or more paths. :: >>> import pathlib >>> one = pathlib.Path('foo/bar/baz') >>> two = pathlib.Path('foo/quux/biz') >>> three = pathlib.Path('f...
python
def find_common_prefix( paths: Sequence[Union[str, pathlib.Path]] ) -> Optional[pathlib.Path]: """ Find the common prefix of two or more paths. :: >>> import pathlib >>> one = pathlib.Path('foo/bar/baz') >>> two = pathlib.Path('foo/quux/biz') >>> three = pathlib.Path('f...
[ "def", "find_common_prefix", "(", "paths", ":", "Sequence", "[", "Union", "[", "str", ",", "pathlib", ".", "Path", "]", "]", ")", "->", "Optional", "[", "pathlib", ".", "Path", "]", ":", "counter", ":", "collections", ".", "Counter", "=", "collections", ...
Find the common prefix of two or more paths. :: >>> import pathlib >>> one = pathlib.Path('foo/bar/baz') >>> two = pathlib.Path('foo/quux/biz') >>> three = pathlib.Path('foo/quux/wuux') :: >>> import uqbar.io >>> str(uqbar.io.find_common_prefix([one, two, thre...
[ "Find", "the", "common", "prefix", "of", "two", "or", "more", "paths", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L16-L48
josiah-wolf-oberholtzer/uqbar
uqbar/io/__init__.py
find_executable
def find_executable(name: str, flags=os.X_OK) -> List[str]: r"""Finds executable `name`. Similar to Unix ``which`` command. Returns list of zero or more full paths to `name`. """ result = [] extensions = [x for x in os.environ.get("PATHEXT", "").split(os.pathsep) if x] path = os.environ.ge...
python
def find_executable(name: str, flags=os.X_OK) -> List[str]: r"""Finds executable `name`. Similar to Unix ``which`` command. Returns list of zero or more full paths to `name`. """ result = [] extensions = [x for x in os.environ.get("PATHEXT", "").split(os.pathsep) if x] path = os.environ.ge...
[ "def", "find_executable", "(", "name", ":", "str", ",", "flags", "=", "os", ".", "X_OK", ")", "->", "List", "[", "str", "]", ":", "result", "=", "[", "]", "extensions", "=", "[", "x", "for", "x", "in", "os", ".", "environ", ".", "get", "(", "\"...
r"""Finds executable `name`. Similar to Unix ``which`` command. Returns list of zero or more full paths to `name`.
[ "r", "Finds", "executable", "name", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L51-L71
josiah-wolf-oberholtzer/uqbar
uqbar/io/__init__.py
relative_to
def relative_to( source_path: Union[str, pathlib.Path], target_path: Union[str, pathlib.Path] ) -> pathlib.Path: """ Generates relative path from ``source_path`` to ``target_path``. Handles the case of paths without a common prefix. :: >>> import pathlib >>> source = pathlib.Path(...
python
def relative_to( source_path: Union[str, pathlib.Path], target_path: Union[str, pathlib.Path] ) -> pathlib.Path: """ Generates relative path from ``source_path`` to ``target_path``. Handles the case of paths without a common prefix. :: >>> import pathlib >>> source = pathlib.Path(...
[ "def", "relative_to", "(", "source_path", ":", "Union", "[", "str", ",", "pathlib", ".", "Path", "]", ",", "target_path", ":", "Union", "[", "str", ",", "pathlib", ".", "Path", "]", ")", "->", "pathlib", ".", "Path", ":", "source_path", "=", "pathlib",...
Generates relative path from ``source_path`` to ``target_path``. Handles the case of paths without a common prefix. :: >>> import pathlib >>> source = pathlib.Path('foo/bar/baz') >>> target = pathlib.Path('foo/quux/biz') :: >>> target.relative_to(source) Tracebac...
[ "Generates", "relative", "path", "from", "source_path", "to", "target_path", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L74-L114
josiah-wolf-oberholtzer/uqbar
uqbar/io/__init__.py
walk
def walk( root_path: Union[str, pathlib.Path], top_down: bool = True ) -> Generator[ Tuple[pathlib.Path, Sequence[pathlib.Path], Sequence[pathlib.Path]], None, None ]: """ Walks a directory tree. Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path` instead of strings. ...
python
def walk( root_path: Union[str, pathlib.Path], top_down: bool = True ) -> Generator[ Tuple[pathlib.Path, Sequence[pathlib.Path], Sequence[pathlib.Path]], None, None ]: """ Walks a directory tree. Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path` instead of strings. ...
[ "def", "walk", "(", "root_path", ":", "Union", "[", "str", ",", "pathlib", ".", "Path", "]", ",", "top_down", ":", "bool", "=", "True", ")", "->", "Generator", "[", "Tuple", "[", "pathlib", ".", "Path", ",", "Sequence", "[", "pathlib", ".", "Path", ...
Walks a directory tree. Like :py:func:`os.walk` but yielding instances of :py:class:`pathlib.Path` instead of strings. :param root_path: foo :param top_down: bar
[ "Walks", "a", "directory", "tree", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L117-L143
josiah-wolf-oberholtzer/uqbar
uqbar/io/__init__.py
write
def write( contents: str, path: Union[str, pathlib.Path], verbose: bool = False, logger_func=None, ) -> bool: """ Writes ``contents`` to ``path``. Checks if ``path`` already exists and only write out new contents if the old contents do not match. Creates any intermediate missing di...
python
def write( contents: str, path: Union[str, pathlib.Path], verbose: bool = False, logger_func=None, ) -> bool: """ Writes ``contents`` to ``path``. Checks if ``path`` already exists and only write out new contents if the old contents do not match. Creates any intermediate missing di...
[ "def", "write", "(", "contents", ":", "str", ",", "path", ":", "Union", "[", "str", ",", "pathlib", ".", "Path", "]", ",", "verbose", ":", "bool", "=", "False", ",", "logger_func", "=", "None", ",", ")", "->", "bool", ":", "print_func", "=", "logge...
Writes ``contents`` to ``path``. Checks if ``path`` already exists and only write out new contents if the old contents do not match. Creates any intermediate missing directories. :param contents: the file contents to write :param path: the path to write to :param verbose: whether to print out...
[ "Writes", "contents", "to", "path", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/io/__init__.py#L146-L186
MatterMiners/cobald
cobald/daemon/debug.py
pretty_ref
def pretty_ref(obj: Any) -> str: """Pretty object reference using ``module.path:qual.name`` format""" try: return obj.__module__ + ':' + obj.__qualname__ except AttributeError: return pretty_ref(type(obj)) + '(...)'
python
def pretty_ref(obj: Any) -> str: """Pretty object reference using ``module.path:qual.name`` format""" try: return obj.__module__ + ':' + obj.__qualname__ except AttributeError: return pretty_ref(type(obj)) + '(...)'
[ "def", "pretty_ref", "(", "obj", ":", "Any", ")", "->", "str", ":", "try", ":", "return", "obj", ".", "__module__", "+", "':'", "+", "obj", ".", "__qualname__", "except", "AttributeError", ":", "return", "pretty_ref", "(", "type", "(", "obj", ")", ")",...
Pretty object reference using ``module.path:qual.name`` format
[ "Pretty", "object", "reference", "using", "module", ".", "path", ":", "qual", ".", "name", "format" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/debug.py#L8-L13
quantmind/agile-toolkit
agiletoolkit/github/remote.py
remote
def remote(ctx): """Display repo github path """ with command(): m = RepoManager(ctx.obj['agile']) click.echo(m.github_repo().repo_path)
python
def remote(ctx): """Display repo github path """ with command(): m = RepoManager(ctx.obj['agile']) click.echo(m.github_repo().repo_path)
[ "def", "remote", "(", "ctx", ")", ":", "with", "command", "(", ")", ":", "m", "=", "RepoManager", "(", "ctx", ".", "obj", "[", "'agile'", "]", ")", "click", ".", "echo", "(", "m", ".", "github_repo", "(", ")", ".", "repo_path", ")" ]
Display repo github path
[ "Display", "repo", "github", "path" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/github/remote.py#L9-L14
josiah-wolf-oberholtzer/uqbar
uqbar/containers/UniqueTreeNode.py
UniqueTreeNode.graph_order
def graph_order(self): """ Get graph-order tuple for node. :: >>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode >>> root_container = UniqueTreeContainer(name="root") >>> outer_container = UniqueTreeContainer(name="outer") >>> i...
python
def graph_order(self): """ Get graph-order tuple for node. :: >>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode >>> root_container = UniqueTreeContainer(name="root") >>> outer_container = UniqueTreeContainer(name="outer") >>> i...
[ "def", "graph_order", "(", "self", ")", ":", "parentage", "=", "tuple", "(", "reversed", "(", "self", ".", "parentage", ")", ")", "graph_order", "=", "[", "]", "for", "i", "in", "range", "(", "len", "(", "parentage", ")", "-", "1", ")", ":", "paren...
Get graph-order tuple for node. :: >>> from uqbar.containers import UniqueTreeContainer, UniqueTreeNode >>> root_container = UniqueTreeContainer(name="root") >>> outer_container = UniqueTreeContainer(name="outer") >>> inner_container = UniqueTreeContainer(name="...
[ "Get", "graph", "-", "order", "tuple", "for", "node", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/containers/UniqueTreeNode.py#L118-L154
xenadevel/PyXenaManager
xenamanager/api/XenaSocket.py
XenaSocket.sendQuery
def sendQuery(self, cmd, multilines=False): """ Send command, wait for response (single or multi lines), test for errors and return the returned code. :param cmd: command to send :param multilines: True - multiline response, False - single line response. :return: command return value. ...
python
def sendQuery(self, cmd, multilines=False): """ Send command, wait for response (single or multi lines), test for errors and return the returned code. :param cmd: command to send :param multilines: True - multiline response, False - single line response. :return: command return value. ...
[ "def", "sendQuery", "(", "self", ",", "cmd", ",", "multilines", "=", "False", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"sendQuery(%s)\"", ",", "cmd", ")", "if", "not", "self", ".", "is_connected", "(", ")", ":", "raise", "socket", ".", "...
Send command, wait for response (single or multi lines), test for errors and return the returned code. :param cmd: command to send :param multilines: True - multiline response, False - single line response. :return: command return value.
[ "Send", "command", "wait", "for", "response", "(", "single", "or", "multi", "lines", ")", "test", "for", "errors", "and", "return", "the", "returned", "code", "." ]
train
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/XenaSocket.py#L97-L123
xenadevel/PyXenaManager
xenamanager/api/XenaSocket.py
XenaSocket.sendQueryVerify
def sendQueryVerify(self, cmd): """ Send command without return value, wait for completion, verify success. :param cmd: command to send """ cmd = cmd.strip() self.logger.debug("sendQueryVerify(%s)", cmd) if not self.is_connected(): raise socket.error("sendQue...
python
def sendQueryVerify(self, cmd): """ Send command without return value, wait for completion, verify success. :param cmd: command to send """ cmd = cmd.strip() self.logger.debug("sendQueryVerify(%s)", cmd) if not self.is_connected(): raise socket.error("sendQue...
[ "def", "sendQueryVerify", "(", "self", ",", "cmd", ")", ":", "cmd", "=", "cmd", ".", "strip", "(", ")", "self", ".", "logger", ".", "debug", "(", "\"sendQueryVerify(%s)\"", ",", "cmd", ")", "if", "not", "self", ".", "is_connected", "(", ")", ":", "ra...
Send command without return value, wait for completion, verify success. :param cmd: command to send
[ "Send", "command", "without", "return", "value", "wait", "for", "completion", "verify", "success", "." ]
train
https://github.com/xenadevel/PyXenaManager/blob/384ca265f73044b8a8b471f5dd7a6103fc54f4df/xenamanager/api/XenaSocket.py#L125-L138
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit.find_external_files
def find_external_files(self, run_input_dir): """ Scan all SHIELDHIT12A config files to find external files used and return them. Also change paths in config files to match convention that all resources are symlinked in job_xxxx/symlink """ beam_file, geo_file, mat_file, ...
python
def find_external_files(self, run_input_dir): """ Scan all SHIELDHIT12A config files to find external files used and return them. Also change paths in config files to match convention that all resources are symlinked in job_xxxx/symlink """ beam_file, geo_file, mat_file, ...
[ "def", "find_external_files", "(", "self", ",", "run_input_dir", ")", ":", "beam_file", ",", "geo_file", ",", "mat_file", ",", "_", "=", "self", ".", "input_files", "# check for external files in BEAM input file", "external_beam_files", "=", "self", ".", "_parse_beam_...
Scan all SHIELDHIT12A config files to find external files used and return them. Also change paths in config files to match convention that all resources are symlinked in job_xxxx/symlink
[ "Scan", "all", "SHIELDHIT12A", "config", "files", "to", "find", "external", "files", "used", "and", "return", "them", ".", "Also", "change", "paths", "in", "config", "files", "to", "match", "convention", "that", "all", "resources", "are", "symlinked", "in", ...
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L75-L109
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._parse_beam_file
def _parse_beam_file(self, file_path, run_input_dir): """Scan SH12A BEAM file for references to external files and return them""" external_files = [] paths_to_replace = [] with open(file_path, 'r') as beam_f: for line in beam_f.readlines(): split_line = line.s...
python
def _parse_beam_file(self, file_path, run_input_dir): """Scan SH12A BEAM file for references to external files and return them""" external_files = [] paths_to_replace = [] with open(file_path, 'r') as beam_f: for line in beam_f.readlines(): split_line = line.s...
[ "def", "_parse_beam_file", "(", "self", ",", "file_path", ",", "run_input_dir", ")", ":", "external_files", "=", "[", "]", "paths_to_replace", "=", "[", "]", "with", "open", "(", "file_path", ",", "'r'", ")", "as", "beam_f", ":", "for", "line", "in", "be...
Scan SH12A BEAM file for references to external files and return them
[ "Scan", "SH12A", "BEAM", "file", "for", "references", "to", "external", "files", "and", "return", "them" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L111-L133
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._parse_geo_file
def _parse_geo_file(self, file_path, run_input_dir): """Scan SH12A GEO file for references to external files (like voxelised geometry) and return them""" external_files = [] paths_to_replace = [] with open(file_path, 'r') as geo_f: for line in geo_f.readlines(): ...
python
def _parse_geo_file(self, file_path, run_input_dir): """Scan SH12A GEO file for references to external files (like voxelised geometry) and return them""" external_files = [] paths_to_replace = [] with open(file_path, 'r') as geo_f: for line in geo_f.readlines(): ...
[ "def", "_parse_geo_file", "(", "self", ",", "file_path", ",", "run_input_dir", ")", ":", "external_files", "=", "[", "]", "paths_to_replace", "=", "[", "]", "with", "open", "(", "file_path", ",", "'r'", ")", "as", "geo_f", ":", "for", "line", "in", "geo_...
Scan SH12A GEO file for references to external files (like voxelised geometry) and return them
[ "Scan", "SH12A", "GEO", "file", "for", "references", "to", "external", "files", "(", "like", "voxelised", "geometry", ")", "and", "return", "them" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L135-L158
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._parse_mat_file
def _parse_mat_file(self, file_path): """Scan SH12A MAT file for ICRU+LOADEX pairs and return found ICRU numbers""" mat_file_sections = self._extract_mat_sections(file_path) return self._analyse_mat_sections(mat_file_sections)
python
def _parse_mat_file(self, file_path): """Scan SH12A MAT file for ICRU+LOADEX pairs and return found ICRU numbers""" mat_file_sections = self._extract_mat_sections(file_path) return self._analyse_mat_sections(mat_file_sections)
[ "def", "_parse_mat_file", "(", "self", ",", "file_path", ")", ":", "mat_file_sections", "=", "self", ".", "_extract_mat_sections", "(", "file_path", ")", "return", "self", ".", "_analyse_mat_sections", "(", "mat_file_sections", ")" ]
Scan SH12A MAT file for ICRU+LOADEX pairs and return found ICRU numbers
[ "Scan", "SH12A", "MAT", "file", "for", "ICRU", "+", "LOADEX", "pairs", "and", "return", "found", "ICRU", "numbers" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L160-L163
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._analyse_mat_sections
def _analyse_mat_sections(sections): """ Cases: - ICRU flag present, LOADDEDX flag missing -> data loaded from some data hardcoded in SH12A binary, no need to load external files - ICRU flag present, LOADDEDX flag present -> data loaded from external files. ICRU number read from ...
python
def _analyse_mat_sections(sections): """ Cases: - ICRU flag present, LOADDEDX flag missing -> data loaded from some data hardcoded in SH12A binary, no need to load external files - ICRU flag present, LOADDEDX flag present -> data loaded from external files. ICRU number read from ...
[ "def", "_analyse_mat_sections", "(", "sections", ")", ":", "icru_numbers", "=", "[", "]", "for", "section", "in", "sections", ":", "load_present", "=", "False", "load_value", "=", "False", "icru_value", "=", "False", "for", "e", "in", "section", ":", "split_...
Cases: - ICRU flag present, LOADDEDX flag missing -> data loaded from some data hardcoded in SH12A binary, no need to load external files - ICRU flag present, LOADDEDX flag present -> data loaded from external files. ICRU number read from ICRU flag, any number following LOADDEDX flag is ...
[ "Cases", ":", "-", "ICRU", "flag", "present", "LOADDEDX", "flag", "missing", "-", ">", "data", "loaded", "from", "some", "data", "hardcoded", "in", "SH12A", "binary", "no", "need", "to", "load", "external", "files", "-", "ICRU", "flag", "present", "LOADDED...
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L182-L210
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._decrypt_icru_files
def _decrypt_icru_files(numbers): """Find matching file names for given ICRU numbers""" import json icru_file = resource_string(__name__, os.path.join('data', 'SH12A_ICRU_table.json')) ref_dict = json.loads(icru_file.decode('ascii')) try: return [ref_dict[e] for e in ...
python
def _decrypt_icru_files(numbers): """Find matching file names for given ICRU numbers""" import json icru_file = resource_string(__name__, os.path.join('data', 'SH12A_ICRU_table.json')) ref_dict = json.loads(icru_file.decode('ascii')) try: return [ref_dict[e] for e in ...
[ "def", "_decrypt_icru_files", "(", "numbers", ")", ":", "import", "json", "icru_file", "=", "resource_string", "(", "__name__", ",", "os", ".", "path", ".", "join", "(", "'data'", ",", "'SH12A_ICRU_table.json'", ")", ")", "ref_dict", "=", "json", ".", "loads...
Find matching file names for given ICRU numbers
[ "Find", "matching", "file", "names", "for", "given", "ICRU", "numbers" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L213-L222
DataMedSci/mcpartools
mcpartools/mcengine/shieldhit.py
ShieldHit._rewrite_paths_in_file
def _rewrite_paths_in_file(config_file, paths_to_replace): """ Rewrite paths in config files to match convention job_xxxx/symlink Requires path to run_xxxx/input/config_file and a list of paths_to_replace """ lines = [] # make a copy of config import shutil ...
python
def _rewrite_paths_in_file(config_file, paths_to_replace): """ Rewrite paths in config files to match convention job_xxxx/symlink Requires path to run_xxxx/input/config_file and a list of paths_to_replace """ lines = [] # make a copy of config import shutil ...
[ "def", "_rewrite_paths_in_file", "(", "config_file", ",", "paths_to_replace", ")", ":", "lines", "=", "[", "]", "# make a copy of config", "import", "shutil", "shutil", ".", "copyfile", "(", "config_file", ",", "str", "(", "config_file", "+", "'_original'", ")", ...
Rewrite paths in config files to match convention job_xxxx/symlink Requires path to run_xxxx/input/config_file and a list of paths_to_replace
[ "Rewrite", "paths", "in", "config", "files", "to", "match", "convention", "job_xxxx", "/", "symlink", "Requires", "path", "to", "run_xxxx", "/", "input", "/", "config_file", "and", "a", "list", "of", "paths_to_replace" ]
train
https://github.com/DataMedSci/mcpartools/blob/84f869094d05bf70f09e8aaeca671ddaa1c56ec4/mcpartools/mcengine/shieldhit.py#L225-L244
Karaage-Cluster/python-tldap
tldap/django/helpers.py
_check_exists
def _check_exists(database: Database, table: LdapObjectClass, key: str, value: str): """ Check if a given LDAP object exists. """ try: get_one(table, Q(**{key: value}), database=database) return True except ObjectDoesNotExist: return False
python
def _check_exists(database: Database, table: LdapObjectClass, key: str, value: str): """ Check if a given LDAP object exists. """ try: get_one(table, Q(**{key: value}), database=database) return True except ObjectDoesNotExist: return False
[ "def", "_check_exists", "(", "database", ":", "Database", ",", "table", ":", "LdapObjectClass", ",", "key", ":", "str", ",", "value", ":", "str", ")", ":", "try", ":", "get_one", "(", "table", ",", "Q", "(", "*", "*", "{", "key", ":", "value", "}",...
Check if a given LDAP object exists.
[ "Check", "if", "a", "given", "LDAP", "object", "exists", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/django/helpers.py#L26-L32
Karaage-Cluster/python-tldap
tldap/django/helpers.py
save_account
def save_account(changes: Changeset, table: LdapObjectClass, database: Database) -> Changeset: """ Modify a changes to add an automatically generated uidNumber. """ d = {} settings = database.settings uid_number = changes.get_value_as_single('uidNumber') if uid_number is None: scheme = sett...
python
def save_account(changes: Changeset, table: LdapObjectClass, database: Database) -> Changeset: """ Modify a changes to add an automatically generated uidNumber. """ d = {} settings = database.settings uid_number = changes.get_value_as_single('uidNumber') if uid_number is None: scheme = sett...
[ "def", "save_account", "(", "changes", ":", "Changeset", ",", "table", ":", "LdapObjectClass", ",", "database", ":", "Database", ")", "->", "Changeset", ":", "d", "=", "{", "}", "settings", "=", "database", ".", "settings", "uid_number", "=", "changes", "....
Modify a changes to add an automatically generated uidNumber.
[ "Modify", "a", "changes", "to", "add", "an", "automatically", "generated", "uidNumber", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/django/helpers.py#L35-L50
aroberge/experimental
experimental/transformers/switch_statement.py
transform_source
def transform_source(text): '''Replaces instances of switch expression: by for __case in _Switch(n): and replaces case expression: by if __case(expression): and default: by if __case(): ''' toks = tokenize.generate_tokens(StringIO...
python
def transform_source(text): '''Replaces instances of switch expression: by for __case in _Switch(n): and replaces case expression: by if __case(expression): and default: by if __case(): ''' toks = tokenize.generate_tokens(StringIO...
[ "def", "transform_source", "(", "text", ")", ":", "toks", "=", "tokenize", ".", "generate_tokens", "(", "StringIO", "(", "text", ")", ".", "readline", ")", "result", "=", "[", "]", "replacing_keyword", "=", "False", "for", "toktype", ",", "tokvalue", ",", ...
Replaces instances of switch expression: by for __case in _Switch(n): and replaces case expression: by if __case(expression): and default: by if __case():
[ "Replaces", "instances", "of" ]
train
https://github.com/aroberge/experimental/blob/031a9be10698b429998436da748b8fdb86f18b47/experimental/transformers/switch_statement.py#L73-L125
Karaage-Cluster/python-tldap
tldap/backend/base.py
LdapBase.search
def search(self, base, scope, filterstr='(objectClass=*)', attrlist=None, limit=None) -> Generator[Tuple[str, dict], None, None]: """ Search for entries in LDAP database. """ _debug("search", base, scope, filterstr, attrlist, limit) # first results if att...
python
def search(self, base, scope, filterstr='(objectClass=*)', attrlist=None, limit=None) -> Generator[Tuple[str, dict], None, None]: """ Search for entries in LDAP database. """ _debug("search", base, scope, filterstr, attrlist, limit) # first results if att...
[ "def", "search", "(", "self", ",", "base", ",", "scope", ",", "filterstr", "=", "'(objectClass=*)'", ",", "attrlist", "=", "None", ",", "limit", "=", "None", ")", "->", "Generator", "[", "Tuple", "[", "str", ",", "dict", "]", ",", "None", ",", "None"...
Search for entries in LDAP database.
[ "Search", "for", "entries", "in", "LDAP", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/backend/base.py#L155-L192
Karaage-Cluster/python-tldap
tldap/backend/base.py
LdapBase.rename
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None: """ rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled. """ raise NotImplementedError()
python
def rename(self, dn: str, new_rdn: str, new_base_dn: Optional[str] = None) -> None: """ rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled. """ raise NotImplementedError()
[ "def", "rename", "(", "self", ",", "dn", ":", "str", ",", "new_rdn", ":", "str", ",", "new_base_dn", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "None", ":", "raise", "NotImplementedError", "(", ")" ]
rename a dn in the ldap database; see ldap module. doesn't return a result if transactions enabled.
[ "rename", "a", "dn", "in", "the", "ldap", "database", ";", "see", "ldap", "module", ".", "doesn", "t", "return", "a", "result", "if", "transactions", "enabled", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/backend/base.py#L277-L282
qubell/contrib-python-qubell-client
example-hier-petclinic.py
prepare_env
def prepare_env(org): """ Example shows how to configure environment from scratch """ # Add services key_service = org.service(type='builtin:cobalt_secure_store', name='Keystore') wf_service = org.service(type='builtin:workflow_service', name='Workflow', parameters='{}') # Add services to environm...
python
def prepare_env(org): """ Example shows how to configure environment from scratch """ # Add services key_service = org.service(type='builtin:cobalt_secure_store', name='Keystore') wf_service = org.service(type='builtin:workflow_service', name='Workflow', parameters='{}') # Add services to environm...
[ "def", "prepare_env", "(", "org", ")", ":", "# Add services", "key_service", "=", "org", ".", "service", "(", "type", "=", "'builtin:cobalt_secure_store'", ",", "name", "=", "'Keystore'", ")", "wf_service", "=", "org", ".", "service", "(", "type", "=", "'bui...
Example shows how to configure environment from scratch
[ "Example", "shows", "how", "to", "configure", "environment", "from", "scratch" ]
train
https://github.com/qubell/contrib-python-qubell-client/blob/4586ea11d5103c2ff9607d3ed922b5a0991b8845/example-hier-petclinic.py#L40-L70
quantmind/agile-toolkit
agiletoolkit/commands.py
start
def start(ctx, debug, version, config): """Commands for devops operations""" ctx.obj = {} ctx.DEBUG = debug if os.path.isfile(config): with open(config) as fp: agile = json.load(fp) else: agile = {} ctx.obj['agile'] = agile if version: click.echo(__version...
python
def start(ctx, debug, version, config): """Commands for devops operations""" ctx.obj = {} ctx.DEBUG = debug if os.path.isfile(config): with open(config) as fp: agile = json.load(fp) else: agile = {} ctx.obj['agile'] = agile if version: click.echo(__version...
[ "def", "start", "(", "ctx", ",", "debug", ",", "version", ",", "config", ")", ":", "ctx", ".", "obj", "=", "{", "}", "ctx", ".", "DEBUG", "=", "debug", "if", "os", ".", "path", ".", "isfile", "(", "config", ")", ":", "with", "open", "(", "confi...
Commands for devops operations
[ "Commands", "for", "devops", "operations" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/commands.py#L36-L50
developersociety/django-glitter
glitter/utils.py
duplicate
def duplicate(obj, value=None, field=None, duplicate_order=None): """ Duplicate all related objects of obj setting field to value. If one of the duplicate objects has an FK to another duplicate object update that as well. Return the duplicate copy of obj. duplicate_order is a list of models...
python
def duplicate(obj, value=None, field=None, duplicate_order=None): """ Duplicate all related objects of obj setting field to value. If one of the duplicate objects has an FK to another duplicate object update that as well. Return the duplicate copy of obj. duplicate_order is a list of models...
[ "def", "duplicate", "(", "obj", ",", "value", "=", "None", ",", "field", "=", "None", ",", "duplicate_order", "=", "None", ")", ":", "using", "=", "router", ".", "db_for_write", "(", "obj", ".", "_meta", ".", "model", ")", "collector", "=", "CloneColle...
Duplicate all related objects of obj setting field to value. If one of the duplicate objects has an FK to another duplicate object update that as well. Return the duplicate copy of obj. duplicate_order is a list of models which specify how the duplicate objects are saved. For complex objects ...
[ "Duplicate", "all", "related", "objects", "of", "obj", "setting", "field", "to", "value", ".", "If", "one", "of", "the", "duplicate", "objects", "has", "an", "FK", "to", "another", "duplicate", "object", "update", "that", "as", "well", ".", "Return", "the"...
train
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/utils.py#L42-L98
davidblaisonneau-orange/foreman
foreman/subItemPuppetClasses.py
SubItemPuppetClasses.getPayloadStruct
def getPayloadStruct(self, attributes, objType): """ Function getPayloadStruct Get the payload structure to do a creation or a modification @param attribute: The data @param objType: SubItem type (e.g: hostgroup for hostgroup_class) @return RETURN: the payload """ ...
python
def getPayloadStruct(self, attributes, objType): """ Function getPayloadStruct Get the payload structure to do a creation or a modification @param attribute: The data @param objType: SubItem type (e.g: hostgroup for hostgroup_class) @return RETURN: the payload """ ...
[ "def", "getPayloadStruct", "(", "self", ",", "attributes", ",", "objType", ")", ":", "payload", "=", "{", "self", ".", "payloadObj", ":", "attributes", ",", "objType", "+", "\"_class\"", ":", "{", "self", ".", "payloadObj", ":", "attributes", "}", "}", "...
Function getPayloadStruct Get the payload structure to do a creation or a modification @param attribute: The data @param objType: SubItem type (e.g: hostgroup for hostgroup_class) @return RETURN: the payload
[ "Function", "getPayloadStruct", "Get", "the", "payload", "structure", "to", "do", "a", "creation", "or", "a", "modification" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/subItemPuppetClasses.py#L34-L45
developersociety/django-glitter
glitter/blocks/video/validators.py
validate_url
def validate_url(value): """ Validate url. """ if not re.match(VIMEO_URL_RE, value) and not re.match(YOUTUBE_URL_RE, value): raise ValidationError('Invalid URL - only Youtube, Vimeo can be used.')
python
def validate_url(value): """ Validate url. """ if not re.match(VIMEO_URL_RE, value) and not re.match(YOUTUBE_URL_RE, value): raise ValidationError('Invalid URL - only Youtube, Vimeo can be used.')
[ "def", "validate_url", "(", "value", ")", ":", "if", "not", "re", ".", "match", "(", "VIMEO_URL_RE", ",", "value", ")", "and", "not", "re", ".", "match", "(", "YOUTUBE_URL_RE", ",", "value", ")", ":", "raise", "ValidationError", "(", "'Invalid URL - only Y...
Validate url.
[ "Validate", "url", "." ]
train
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/blocks/video/validators.py#L45-L48
Karaage-Cluster/python-tldap
tldap/transaction.py
enter_transaction_management
def enter_transaction_management(using=None): """ Enters transaction management for a running thread. It must be balanced with the appropriate leave_transaction_management call, since the actual state is managed as a stack. The state and dirty flag are carried over from the surrounding block or ...
python
def enter_transaction_management(using=None): """ Enters transaction management for a running thread. It must be balanced with the appropriate leave_transaction_management call, since the actual state is managed as a stack. The state and dirty flag are carried over from the surrounding block or ...
[ "def", "enter_transaction_management", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", "[", "usin...
Enters transaction management for a running thread. It must be balanced with the appropriate leave_transaction_management call, since the actual state is managed as a stack. The state and dirty flag are carried over from the surrounding block or from the settings, if there is no surrounding block (dirt...
[ "Enters", "transaction", "management", "for", "a", "running", "thread", ".", "It", "must", "be", "balanced", "with", "the", "appropriate", "leave_transaction_management", "call", "since", "the", "actual", "state", "is", "managed", "as", "a", "stack", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L45-L61
Karaage-Cluster/python-tldap
tldap/transaction.py
leave_transaction_management
def leave_transaction_management(using=None): """ Leaves transaction management for a running thread. A dirty flag is carried over to the surrounding block, as a commit will commit all changes, even those from outside. (Commits are on connection level.) """ if using is None: for using in...
python
def leave_transaction_management(using=None): """ Leaves transaction management for a running thread. A dirty flag is carried over to the surrounding block, as a commit will commit all changes, even those from outside. (Commits are on connection level.) """ if using is None: for using in...
[ "def", "leave_transaction_management", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", "[", "usin...
Leaves transaction management for a running thread. A dirty flag is carried over to the surrounding block, as a commit will commit all changes, even those from outside. (Commits are on connection level.)
[ "Leaves", "transaction", "management", "for", "a", "running", "thread", ".", "A", "dirty", "flag", "is", "carried", "over", "to", "the", "surrounding", "block", "as", "a", "commit", "will", "commit", "all", "changes", "even", "those", "from", "outside", ".",...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L64-L76
Karaage-Cluster/python-tldap
tldap/transaction.py
is_dirty
def is_dirty(using=None): """ Returns True if the current transaction requires a commit for changes to happen. """ if using is None: dirty = False for using in tldap.backend.connections: connection = tldap.backend.connections[using] if connection.is_dirty(): ...
python
def is_dirty(using=None): """ Returns True if the current transaction requires a commit for changes to happen. """ if using is None: dirty = False for using in tldap.backend.connections: connection = tldap.backend.connections[using] if connection.is_dirty(): ...
[ "def", "is_dirty", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "dirty", "=", "False", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", "["...
Returns True if the current transaction requires a commit for changes to happen.
[ "Returns", "True", "if", "the", "current", "transaction", "requires", "a", "commit", "for", "changes", "to", "happen", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L79-L92
Karaage-Cluster/python-tldap
tldap/transaction.py
is_managed
def is_managed(using=None): """ Checks whether the transaction manager is in manual or in auto state. """ if using is None: managed = False for using in tldap.backend.connections: connection = tldap.backend.connections[using] if connection.is_managed(): ...
python
def is_managed(using=None): """ Checks whether the transaction manager is in manual or in auto state. """ if using is None: managed = False for using in tldap.backend.connections: connection = tldap.backend.connections[using] if connection.is_managed(): ...
[ "def", "is_managed", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "managed", "=", "False", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", ...
Checks whether the transaction manager is in manual or in auto state.
[ "Checks", "whether", "the", "transaction", "manager", "is", "in", "manual", "or", "in", "auto", "state", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L95-L107
Karaage-Cluster/python-tldap
tldap/transaction.py
commit
def commit(using=None): """ Does the commit itself and resets the dirty flag. """ if using is None: for using in tldap.backend.connections: connection = tldap.backend.connections[using] connection.commit() return connection = tldap.backend.connections[using] ...
python
def commit(using=None): """ Does the commit itself and resets the dirty flag. """ if using is None: for using in tldap.backend.connections: connection = tldap.backend.connections[using] connection.commit() return connection = tldap.backend.connections[using] ...
[ "def", "commit", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", "[", "using", "]", "connecti...
Does the commit itself and resets the dirty flag.
[ "Does", "the", "commit", "itself", "and", "resets", "the", "dirty", "flag", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L110-L120
Karaage-Cluster/python-tldap
tldap/transaction.py
rollback
def rollback(using=None): """ This function does the rollback itself and resets the dirty flag. """ if using is None: for using in tldap.backend.connections: connection = tldap.backend.connections[using] connection.rollback() return connection = tldap.backend....
python
def rollback(using=None): """ This function does the rollback itself and resets the dirty flag. """ if using is None: for using in tldap.backend.connections: connection = tldap.backend.connections[using] connection.rollback() return connection = tldap.backend....
[ "def", "rollback", "(", "using", "=", "None", ")", ":", "if", "using", "is", "None", ":", "for", "using", "in", "tldap", ".", "backend", ".", "connections", ":", "connection", "=", "tldap", ".", "backend", ".", "connections", "[", "using", "]", "connec...
This function does the rollback itself and resets the dirty flag.
[ "This", "function", "does", "the", "rollback", "itself", "and", "resets", "the", "dirty", "flag", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L123-L133
Karaage-Cluster/python-tldap
tldap/transaction.py
_transaction_func
def _transaction_func(entering, exiting, using): """ Takes 3 things, an entering function (what to do to start this block of transaction management), an exiting function (what to do to end it, on both success and failure, and using which can be: None, indiciating transaction should occur on all defi...
python
def _transaction_func(entering, exiting, using): """ Takes 3 things, an entering function (what to do to start this block of transaction management), an exiting function (what to do to end it, on both success and failure, and using which can be: None, indiciating transaction should occur on all defi...
[ "def", "_transaction_func", "(", "entering", ",", "exiting", ",", "using", ")", ":", "# Note that although the first argument is *called* `using`, it", "# may actually be a function; @autocommit and @autocommit('foo')", "# are both allowed forms.", "if", "callable", "(", "using", "...
Takes 3 things, an entering function (what to do to start this block of transaction management), an exiting function (what to do to end it, on both success and failure, and using which can be: None, indiciating transaction should occur on all defined servers, or a callable, indicating that using is None...
[ "Takes", "3", "things", "an", "entering", "function", "(", "what", "to", "do", "to", "start", "this", "block", "of", "transaction", "management", ")", "an", "exiting", "function", "(", "what", "to", "do", "to", "end", "it", "on", "both", "success", "and"...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L179-L195
Karaage-Cluster/python-tldap
tldap/transaction.py
commit_on_success
def commit_on_success(using=None): """ This decorator activates commit on response. This way, if the view function runs successfully, a commit is made; if the viewfunc produces an exception, a rollback is made. This is one of the most common ways to do transaction control in Web apps. """ de...
python
def commit_on_success(using=None): """ This decorator activates commit on response. This way, if the view function runs successfully, a commit is made; if the viewfunc produces an exception, a rollback is made. This is one of the most common ways to do transaction control in Web apps. """ de...
[ "def", "commit_on_success", "(", "using", "=", "None", ")", ":", "def", "entering", "(", "using", ")", ":", "enter_transaction_management", "(", "using", "=", "using", ")", "def", "exiting", "(", "exc_value", ",", "using", ")", ":", "try", ":", "if", "ex...
This decorator activates commit on response. This way, if the view function runs successfully, a commit is made; if the viewfunc produces an exception, a rollback is made. This is one of the most common ways to do transaction control in Web apps.
[ "This", "decorator", "activates", "commit", "on", "response", ".", "This", "way", "if", "the", "view", "function", "runs", "successfully", "a", "commit", "is", "made", ";", "if", "the", "viewfunc", "produces", "an", "exception", "a", "rollback", "is", "made"...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L198-L218
Karaage-Cluster/python-tldap
tldap/transaction.py
commit_manually
def commit_manually(using=None): """ Decorator that activates manual transaction control. It just disables automatic transaction control and doesn't do any commit/rollback of its own -- it's up to the user to call the commit and rollback functions themselves. """ def entering(using): ...
python
def commit_manually(using=None): """ Decorator that activates manual transaction control. It just disables automatic transaction control and doesn't do any commit/rollback of its own -- it's up to the user to call the commit and rollback functions themselves. """ def entering(using): ...
[ "def", "commit_manually", "(", "using", "=", "None", ")", ":", "def", "entering", "(", "using", ")", ":", "enter_transaction_management", "(", "using", "=", "using", ")", "def", "exiting", "(", "exc_value", ",", "using", ")", ":", "leave_transaction_management...
Decorator that activates manual transaction control. It just disables automatic transaction control and doesn't do any commit/rollback of its own -- it's up to the user to call the commit and rollback functions themselves.
[ "Decorator", "that", "activates", "manual", "transaction", "control", ".", "It", "just", "disables", "automatic", "transaction", "control", "and", "doesn", "t", "do", "any", "commit", "/", "rollback", "of", "its", "own", "--", "it", "s", "up", "to", "the", ...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/transaction.py#L221-L234
jamescooke/flake8-aaa
src/flake8_aaa/checker.py
Checker.run
def run(self) -> Generator[Tuple[int, int, str, type], None, None]: """ Yields: tuple (line_number: int, offset: int, text: str, check: type) """ if is_test_file(self.filename): self.load() for func in self.all_funcs(): try: ...
python
def run(self) -> Generator[Tuple[int, int, str, type], None, None]: """ Yields: tuple (line_number: int, offset: int, text: str, check: type) """ if is_test_file(self.filename): self.load() for func in self.all_funcs(): try: ...
[ "def", "run", "(", "self", ")", "->", "Generator", "[", "Tuple", "[", "int", ",", "int", ",", "str", ",", "type", "]", ",", "None", ",", "None", "]", ":", "if", "is_test_file", "(", "self", ".", "filename", ")", ":", "self", ".", "load", "(", "...
Yields: tuple (line_number: int, offset: int, text: str, check: type)
[ "Yields", ":", "tuple", "(", "line_number", ":", "int", "offset", ":", "int", "text", ":", "str", "check", ":", "type", ")" ]
train
https://github.com/jamescooke/flake8-aaa/blob/29938b96845fe32ced4358ba66af3b3be2a37794/src/flake8_aaa/checker.py#L42-L54
developersociety/django-glitter
glitter/pages/middleware.py
GlitterUrlConfMiddleware.process_request
def process_request(self, request): """ Reloads glitter URL patterns if page URLs change. Avoids having to restart the server to recreate the glitter URLs being used by Django. """ global _urlconf_pages page_list = list( Page.objects.exclude(glitter_app_name...
python
def process_request(self, request): """ Reloads glitter URL patterns if page URLs change. Avoids having to restart the server to recreate the glitter URLs being used by Django. """ global _urlconf_pages page_list = list( Page.objects.exclude(glitter_app_name...
[ "def", "process_request", "(", "self", ",", "request", ")", ":", "global", "_urlconf_pages", "page_list", "=", "list", "(", "Page", ".", "objects", ".", "exclude", "(", "glitter_app_name", "=", "''", ")", ".", "values_list", "(", "'id'", ",", "'url'", ")",...
Reloads glitter URL patterns if page URLs change. Avoids having to restart the server to recreate the glitter URLs being used by Django.
[ "Reloads", "glitter", "URL", "patterns", "if", "page", "URLs", "change", "." ]
train
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/pages/middleware.py#L38-L55
MatterMiners/cobald
cobald/daemon/runners/base_runner.py
BaseRunner.run
def run(self): """ Execute all current and future payloads Blocks and executes payloads until :py:meth:`stop` is called. It is an error for any orphaned payload to return or raise. """ self._logger.info('runner started: %s', self) try: with self._lock...
python
def run(self): """ Execute all current and future payloads Blocks and executes payloads until :py:meth:`stop` is called. It is an error for any orphaned payload to return or raise. """ self._logger.info('runner started: %s', self) try: with self._lock...
[ "def", "run", "(", "self", ")", ":", "self", ".", "_logger", ".", "info", "(", "'runner started: %s'", ",", "self", ")", "try", ":", "with", "self", ".", "_lock", ":", "assert", "not", "self", ".", "running", ".", "is_set", "(", ")", "and", "self", ...
Execute all current and future payloads Blocks and executes payloads until :py:meth:`stop` is called. It is an error for any orphaned payload to return or raise.
[ "Execute", "all", "current", "and", "future", "payloads" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/base_runner.py#L45-L67
MatterMiners/cobald
cobald/daemon/runners/base_runner.py
BaseRunner.stop
def stop(self): """Stop execution of all current and future payloads""" if not self.running.wait(0.2): return self._logger.debug('runner disabled: %s', self) with self._lock: self.running.clear() self._stopped.wait()
python
def stop(self): """Stop execution of all current and future payloads""" if not self.running.wait(0.2): return self._logger.debug('runner disabled: %s', self) with self._lock: self.running.clear() self._stopped.wait()
[ "def", "stop", "(", "self", ")", ":", "if", "not", "self", ".", "running", ".", "wait", "(", "0.2", ")", ":", "return", "self", ".", "_logger", ".", "debug", "(", "'runner disabled: %s'", ",", "self", ")", "with", "self", ".", "_lock", ":", "self", ...
Stop execution of all current and future payloads
[ "Stop", "execution", "of", "all", "current", "and", "future", "payloads" ]
train
https://github.com/MatterMiners/cobald/blob/264138de4382d1c9b53fabcbc6660e10b33a914d/cobald/daemon/runners/base_runner.py#L72-L79
josiah-wolf-oberholtzer/uqbar
uqbar/strings.py
delimit_words
def delimit_words(string: str) -> Generator[str, None, None]: """ Delimit a string at word boundaries. :: >>> import uqbar.strings >>> list(uqbar.strings.delimit_words("i want to believe")) ['i', 'want', 'to', 'believe'] :: >>> list(uqbar.strings.delimit_words("S3Buck...
python
def delimit_words(string: str) -> Generator[str, None, None]: """ Delimit a string at word boundaries. :: >>> import uqbar.strings >>> list(uqbar.strings.delimit_words("i want to believe")) ['i', 'want', 'to', 'believe'] :: >>> list(uqbar.strings.delimit_words("S3Buck...
[ "def", "delimit_words", "(", "string", ":", "str", ")", "->", "Generator", "[", "str", ",", "None", ",", "None", "]", ":", "# TODO: Reimplement this", "wordlike_characters", "=", "(", "\"<\"", ",", "\">\"", ",", "\"!\"", ")", "current_word", "=", "\"\"", "...
Delimit a string at word boundaries. :: >>> import uqbar.strings >>> list(uqbar.strings.delimit_words("i want to believe")) ['i', 'want', 'to', 'believe'] :: >>> list(uqbar.strings.delimit_words("S3Bucket")) ['S3', 'Bucket'] :: >>> list(uqbar.strings.del...
[ "Delimit", "a", "string", "at", "word", "boundaries", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/strings.py#L18-L78
josiah-wolf-oberholtzer/uqbar
uqbar/strings.py
normalize
def normalize(string: str) -> str: """ Normalizes whitespace. Strips leading and trailing blank lines, dedents, and removes trailing whitespace from the result. """ string = string.replace("\t", " ") lines = string.split("\n") while lines and (not lines[0] or lines[0].isspace()): ...
python
def normalize(string: str) -> str: """ Normalizes whitespace. Strips leading and trailing blank lines, dedents, and removes trailing whitespace from the result. """ string = string.replace("\t", " ") lines = string.split("\n") while lines and (not lines[0] or lines[0].isspace()): ...
[ "def", "normalize", "(", "string", ":", "str", ")", "->", "str", ":", "string", "=", "string", ".", "replace", "(", "\"\\t\"", ",", "\" \"", ")", "lines", "=", "string", ".", "split", "(", "\"\\n\"", ")", "while", "lines", "and", "(", "not", "line...
Normalizes whitespace. Strips leading and trailing blank lines, dedents, and removes trailing whitespace from the result.
[ "Normalizes", "whitespace", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/strings.py#L81-L98
josiah-wolf-oberholtzer/uqbar
uqbar/strings.py
to_dash_case
def to_dash_case(string: str) -> str: """ Convert a string to dash-delimited words. :: >>> import uqbar.strings >>> string = 'Tô Đặc Biệt Xe Lửa' >>> print(uqbar.strings.to_dash_case(string)) to-dac-biet-xe-lua :: >>> string = 'alpha.beta.gamma' >>> pr...
python
def to_dash_case(string: str) -> str: """ Convert a string to dash-delimited words. :: >>> import uqbar.strings >>> string = 'Tô Đặc Biệt Xe Lửa' >>> print(uqbar.strings.to_dash_case(string)) to-dac-biet-xe-lua :: >>> string = 'alpha.beta.gamma' >>> pr...
[ "def", "to_dash_case", "(", "string", ":", "str", ")", "->", "str", ":", "string", "=", "unidecode", ".", "unidecode", "(", "string", ")", "words", "=", "(", "_", ".", "lower", "(", ")", "for", "_", "in", "delimit_words", "(", "string", ")", ")", "...
Convert a string to dash-delimited words. :: >>> import uqbar.strings >>> string = 'Tô Đặc Biệt Xe Lửa' >>> print(uqbar.strings.to_dash_case(string)) to-dac-biet-xe-lua :: >>> string = 'alpha.beta.gamma' >>> print(uqbar.strings.to_dash_case(string)) al...
[ "Convert", "a", "string", "to", "dash", "-", "delimited", "words", "." ]
train
https://github.com/josiah-wolf-oberholtzer/uqbar/blob/eca7fefebbbee1e2ae13bf5d6baa838be66b1db6/uqbar/strings.py#L101-L122
aroberge/experimental
experimental/transformers/utils/simple2to3.py
get_lib2to3_fixers
def get_lib2to3_fixers(): '''returns a list of all fixers found in the lib2to3 library''' fixers = [] fixer_dirname = fixer_dir.__path__[0] for name in sorted(os.listdir(fixer_dirname)): if name.startswith("fix_") and name.endswith(".py"): fixers.append("lib2to3.fixes." + name[:-3]) ...
python
def get_lib2to3_fixers(): '''returns a list of all fixers found in the lib2to3 library''' fixers = [] fixer_dirname = fixer_dir.__path__[0] for name in sorted(os.listdir(fixer_dirname)): if name.startswith("fix_") and name.endswith(".py"): fixers.append("lib2to3.fixes." + name[:-3]) ...
[ "def", "get_lib2to3_fixers", "(", ")", ":", "fixers", "=", "[", "]", "fixer_dirname", "=", "fixer_dir", ".", "__path__", "[", "0", "]", "for", "name", "in", "sorted", "(", "os", ".", "listdir", "(", "fixer_dirname", ")", ")", ":", "if", "name", ".", ...
returns a list of all fixers found in the lib2to3 library
[ "returns", "a", "list", "of", "all", "fixers", "found", "in", "the", "lib2to3", "library" ]
train
https://github.com/aroberge/experimental/blob/031a9be10698b429998436da748b8fdb86f18b47/experimental/transformers/utils/simple2to3.py#L10-L17
aroberge/experimental
experimental/transformers/utils/simple2to3.py
get_single_fixer
def get_single_fixer(fixname): '''return a single fixer found in the lib2to3 library''' fixer_dirname = fixer_dir.__path__[0] for name in sorted(os.listdir(fixer_dirname)): if (name.startswith("fix_") and name.endswith(".py") and fixname == name[4:-3]): return "lib2to3.fixes...
python
def get_single_fixer(fixname): '''return a single fixer found in the lib2to3 library''' fixer_dirname = fixer_dir.__path__[0] for name in sorted(os.listdir(fixer_dirname)): if (name.startswith("fix_") and name.endswith(".py") and fixname == name[4:-3]): return "lib2to3.fixes...
[ "def", "get_single_fixer", "(", "fixname", ")", ":", "fixer_dirname", "=", "fixer_dir", ".", "__path__", "[", "0", "]", "for", "name", "in", "sorted", "(", "os", ".", "listdir", "(", "fixer_dirname", ")", ")", ":", "if", "(", "name", ".", "startswith", ...
return a single fixer found in the lib2to3 library
[ "return", "a", "single", "fixer", "found", "in", "the", "lib2to3", "library" ]
train
https://github.com/aroberge/experimental/blob/031a9be10698b429998436da748b8fdb86f18b47/experimental/transformers/utils/simple2to3.py#L20-L26
Karaage-Cluster/python-tldap
tldap/fields.py
Field.to_db
def to_db(self, value): """ Returns field's single value prepared for saving into a database. """ # ensure value is valid self.validate(value) assert isinstance(value, list) value = list(value) for i, v in enumerate(value): value[i] = self.value_to_db(v) ...
python
def to_db(self, value): """ Returns field's single value prepared for saving into a database. """ # ensure value is valid self.validate(value) assert isinstance(value, list) value = list(value) for i, v in enumerate(value): value[i] = self.value_to_db(v) ...
[ "def", "to_db", "(", "self", ",", "value", ")", ":", "# ensure value is valid", "self", ".", "validate", "(", "value", ")", "assert", "isinstance", "(", "value", ",", "list", ")", "value", "=", "list", "(", "value", ")", "for", "i", ",", "v", "in", "...
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L42-L55
Karaage-Cluster/python-tldap
tldap/fields.py
Field.to_python
def to_python(self, value): """ Converts the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ assert isinstance(value, list) ...
python
def to_python(self, value): """ Converts the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ assert isinstance(value, list) ...
[ "def", "to_python", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "list", ")", "# convert every value in list", "value", "=", "list", "(", "value", ")", "for", "i", ",", "v", "in", "enumerate", "(", "value", ")", ":", ...
Converts the input value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "converted", "va...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L57-L71
Karaage-Cluster/python-tldap
tldap/fields.py
Field.validate
def validate(self, value): """ Validates value and throws ValidationError. Subclasses should override this to provide validation logic. """ # check object type if not isinstance(value, list): raise tldap.exceptions.ValidationError( "is not a li...
python
def validate(self, value): """ Validates value and throws ValidationError. Subclasses should override this to provide validation logic. """ # check object type if not isinstance(value, list): raise tldap.exceptions.ValidationError( "is not a li...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "# check object type", "if", "not", "isinstance", "(", "value", ",", "list", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"is not a list and max_instances is %s\"", "%", "se...
Validates value and throws ValidationError. Subclasses should override this to provide validation logic.
[ "Validates", "value", "and", "throws", "ValidationError", ".", "Subclasses", "should", "override", "this", "to", "provide", "validation", "logic", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L73-L96
Karaage-Cluster/python-tldap
tldap/fields.py
Field.clean
def clean(self, value): """ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. """ value = self.to_python(value) self.validate(value) return value
python
def clean(self, value): """ Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised. """ value = self.to_python(value) self.validate(value) return value
[ "def", "clean", "(", "self", ",", "value", ")", ":", "value", "=", "self", ".", "to_python", "(", "value", ")", "self", ".", "validate", "(", "value", ")", "return", "value" ]
Convert the value's type and run validation. Validation errors from to_python and validate are propagated. The correct value is returned if no error is raised.
[ "Convert", "the", "value", "s", "type", "and", "run", "validation", ".", "Validation", "errors", "from", "to_python", "and", "validate", "are", "propagated", ".", "The", "correct", "value", "is", "returned", "if", "no", "error", "is", "raised", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L98-L106
Karaage-Cluster/python-tldap
tldap/fields.py
CharField.value_to_db
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ if isinstance(value, six.string_types): value = value.encode("utf_8") return value
python
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ if isinstance(value, six.string_types): value = value.encode("utf_8") return value
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "value", "=", "value", ".", "encode", "(", "\"utf_8\"", ")", "return", "value" ]
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L195-L199
Karaage-Cluster/python-tldap
tldap/fields.py
CharField.value_to_python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
[ "def", "value_to_python", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be a bytes\"", ")", "value", "=", "value", ".", "dec...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L201-L211
Karaage-Cluster/python-tldap
tldap/fields.py
CharField.value_validate
def value_validate(self, value): """ Validates value and throws ValidationError. Subclasses should override this to provide validation logic. """ if not isinstance(value, six.string_types): raise tldap.exceptions.ValidationError("should be a string")
python
def value_validate(self, value): """ Validates value and throws ValidationError. Subclasses should override this to provide validation logic. """ if not isinstance(value, six.string_types): raise tldap.exceptions.ValidationError("should be a string")
[ "def", "value_validate", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "string_types", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be a string\"", ")" ]
Validates value and throws ValidationError. Subclasses should override this to provide validation logic.
[ "Validates", "value", "and", "throws", "ValidationError", ".", "Subclasses", "should", "override", "this", "to", "provide", "validation", "logic", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L213-L219
Karaage-Cluster/python-tldap
tldap/fields.py
IntegerField.value_to_python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
[ "def", "value_to_python", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be bytes\"", ")", "if", "value", "is", "None", ":", ...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L254-L268
Karaage-Cluster/python-tldap
tldap/fields.py
IntegerField.value_to_db
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, six.integer_types) return str(value).encode("utf_8")
python
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, six.integer_types) return str(value).encode("utf_8")
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "return", "str", "(", "value", ")", ".", "encode", "(", "\"utf_8\"", ")" ]
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L270-L273
Karaage-Cluster/python-tldap
tldap/fields.py
IntegerField.value_validate
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
python
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
[ "def", "value_validate", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be a integer\"", ")", "try", ":", ...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L275-L288
Karaage-Cluster/python-tldap
tldap/fields.py
DaysSinceEpochField.value_to_python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
[ "def", "value_to_python", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be a bytes\"", ")", "try", ":", "value", "=", "int",...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L294-L314
Karaage-Cluster/python-tldap
tldap/fields.py
DaysSinceEpochField.value_to_db
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, datetime.date) assert not isinstance(value, datetime.datetime) try: value = value - datetime.date(year=1970, month=1, day=1) except Overfl...
python
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, datetime.date) assert not isinstance(value, datetime.datetime) try: value = value - datetime.date(year=1970, month=1, day=1) except Overfl...
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "datetime", ".", "date", ")", "assert", "not", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", "try", ":", "value", "=", "value", "...
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L316-L326
Karaage-Cluster/python-tldap
tldap/fields.py
DaysSinceEpochField.value_validate
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
python
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
[ "def", "value_validate", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "datetime", ".", "date", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"is invalid date\"", ")", "# a datetime is also a...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L328-L339
Karaage-Cluster/python-tldap
tldap/fields.py
SecondsSinceEpochField.value_to_db
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, datetime.datetime) try: value = value - datetime.datetime(1970, 1, 1) except OverflowError: raise tldap.exceptions.ValidationError("is...
python
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, datetime.datetime) try: value = value - datetime.datetime(1970, 1, 1) except OverflowError: raise tldap.exceptions.ValidationError("is...
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", "try", ":", "value", "=", "value", "-", "datetime", ".", "datetime", "(", "1970", ",", "1", ",", "1", ")", "except...
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L367-L379
Karaage-Cluster/python-tldap
tldap/fields.py
SecondsSinceEpochField.value_validate
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
python
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
[ "def", "value_validate", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"is invalid date time\"", ")" ]
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L381-L389
Karaage-Cluster/python-tldap
tldap/fields.py
SidField.value_to_python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
python
def value_to_python(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isins...
[ "def", "value_to_python", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "bytes", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"should be a bytes\"", ")", "length", "=", "len", "(", "valu...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L395-L420
Karaage-Cluster/python-tldap
tldap/fields.py
SidField.value_to_db
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, str) array = value.split("-") length = len(array) - 3 assert length >= 0 assert array[0] == 'S' array = array[1:2] + [length, 0, 0,...
python
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, str) array = value.split("-") length = len(array) - 3 assert length >= 0 assert array[0] == 'S' array = array[1:2] + [length, 0, 0,...
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "str", ")", "array", "=", "value", ".", "split", "(", "\"-\"", ")", "length", "=", "len", "(", "array", ")", "-", "3", "assert", "length", ">=", "...
Returns field's single value prepared for saving into a database.
[ "Returns", "field", "s", "single", "value", "prepared", "for", "saving", "into", "a", "database", "." ]
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L422-L436
Karaage-Cluster/python-tldap
tldap/fields.py
SidField.value_validate
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
python
def value_validate(self, value): """ Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this. """ if not isinst...
[ "def", "value_validate", "(", "self", ",", "value", ")", ":", "if", "not", "isinstance", "(", "value", ",", "str", ")", ":", "raise", "tldap", ".", "exceptions", ".", "ValidationError", "(", "\"Invalid sid\"", ")", "array", "=", "value", ".", "split", "(...
Converts the input single value into the expected Python data type, raising django.core.exceptions.ValidationError if the data can't be converted. Returns the converted value. Subclasses should override this.
[ "Converts", "the", "input", "single", "value", "into", "the", "expected", "Python", "data", "type", "raising", "django", ".", "core", ".", "exceptions", ".", "ValidationError", "if", "the", "data", "can", "t", "be", "converted", ".", "Returns", "the", "conve...
train
https://github.com/Karaage-Cluster/python-tldap/blob/61f1af74a3648cb6491e7eeb1ee2eb395d67bf59/tldap/fields.py#L438-L460
quantmind/agile-toolkit
agiletoolkit/api/components.py
RepoComponents.get
def get(self, id): """Get data for this component """ id = self.as_id(id) url = '%s/%s' % (self, id) response = self.http.get(url, auth=self.auth) response.raise_for_status() return response.json()
python
def get(self, id): """Get data for this component """ id = self.as_id(id) url = '%s/%s' % (self, id) response = self.http.get(url, auth=self.auth) response.raise_for_status() return response.json()
[ "def", "get", "(", "self", ",", "id", ")", ":", "id", "=", "self", ".", "as_id", "(", "id", ")", "url", "=", "'%s/%s'", "%", "(", "self", ",", "id", ")", "response", "=", "self", ".", "http", ".", "get", "(", "url", ",", "auth", "=", "self", ...
Get data for this component
[ "Get", "data", "for", "this", "component" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L38-L45
quantmind/agile-toolkit
agiletoolkit/api/components.py
RepoComponents.create
def create(self, data): """Create a new component """ response = self.http.post(str(self), json=data, auth=self.auth) response.raise_for_status() return response.json()
python
def create(self, data): """Create a new component """ response = self.http.post(str(self), json=data, auth=self.auth) response.raise_for_status() return response.json()
[ "def", "create", "(", "self", ",", "data", ")", ":", "response", "=", "self", ".", "http", ".", "post", "(", "str", "(", "self", ")", ",", "json", "=", "data", ",", "auth", "=", "self", ".", "auth", ")", "response", ".", "raise_for_status", "(", ...
Create a new component
[ "Create", "a", "new", "component" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L47-L52
quantmind/agile-toolkit
agiletoolkit/api/components.py
RepoComponents.update
def update(self, id, data): """Update a component """ id = self.as_id(id) response = self.http.patch( '%s/%s' % (self, id), json=data, auth=self.auth ) response.raise_for_status() return response.json()
python
def update(self, id, data): """Update a component """ id = self.as_id(id) response = self.http.patch( '%s/%s' % (self, id), json=data, auth=self.auth ) response.raise_for_status() return response.json()
[ "def", "update", "(", "self", ",", "id", ",", "data", ")", ":", "id", "=", "self", ".", "as_id", "(", "id", ")", "response", "=", "self", ".", "http", ".", "patch", "(", "'%s/%s'", "%", "(", "self", ",", "id", ")", ",", "json", "=", "data", "...
Update a component
[ "Update", "a", "component" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L54-L62
quantmind/agile-toolkit
agiletoolkit/api/components.py
RepoComponents.delete
def delete(self, id): """Delete a component by id """ id = self.as_id(id) response = self.http.delete( '%s/%s' % (self.api_url, id), auth=self.auth) response.raise_for_status()
python
def delete(self, id): """Delete a component by id """ id = self.as_id(id) response = self.http.delete( '%s/%s' % (self.api_url, id), auth=self.auth) response.raise_for_status()
[ "def", "delete", "(", "self", ",", "id", ")", ":", "id", "=", "self", ".", "as_id", "(", "id", ")", "response", "=", "self", ".", "http", ".", "delete", "(", "'%s/%s'", "%", "(", "self", ".", "api_url", ",", "id", ")", ",", "auth", "=", "self",...
Delete a component by id
[ "Delete", "a", "component", "by", "id" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L64-L71
quantmind/agile-toolkit
agiletoolkit/api/components.py
RepoComponents.get_list
def get_list(self, url=None, callback=None, limit=100, **data): """Get a list of this github component :param url: full url :param Comp: a :class:`.Component` class :param callback: Optional callback :param limit: Optional number of items to retrieve :param data: addition...
python
def get_list(self, url=None, callback=None, limit=100, **data): """Get a list of this github component :param url: full url :param Comp: a :class:`.Component` class :param callback: Optional callback :param limit: Optional number of items to retrieve :param data: addition...
[ "def", "get_list", "(", "self", ",", "url", "=", "None", ",", "callback", "=", "None", ",", "limit", "=", "100", ",", "*", "*", "data", ")", ":", "url", "=", "url", "or", "str", "(", "self", ")", "data", "=", "dict", "(", "(", "(", "k", ",", ...
Get a list of this github component :param url: full url :param Comp: a :class:`.Component` class :param callback: Optional callback :param limit: Optional number of items to retrieve :param data: additional query data :return: a list of ``Comp`` objects with data
[ "Get", "a", "list", "of", "this", "github", "component", ":", "param", "url", ":", "full", "url", ":", "param", "Comp", ":", "a", ":", "class", ":", ".", "Component", "class", ":", "param", "callback", ":", "Optional", "callback", ":", "param", "limit"...
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L73-L105
quantmind/agile-toolkit
agiletoolkit/api/components.py
Issues.comments
def comments(self, issue): """Return all comments for this issue/pull request """ commit = self.as_id(issue) return self.get_list(url='%s/%s/comments' % (self, commit))
python
def comments(self, issue): """Return all comments for this issue/pull request """ commit = self.as_id(issue) return self.get_list(url='%s/%s/comments' % (self, commit))
[ "def", "comments", "(", "self", ",", "issue", ")", ":", "commit", "=", "self", ".", "as_id", "(", "issue", ")", "return", "self", ".", "get_list", "(", "url", "=", "'%s/%s/comments'", "%", "(", "self", ",", "commit", ")", ")" ]
Return all comments for this issue/pull request
[ "Return", "all", "comments", "for", "this", "issue", "/", "pull", "request" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/api/components.py#L139-L143
developersociety/django-glitter
glitter/admin.py
GlitterAdminMixin.has_edit_permission
def has_edit_permission(self, request, obj=None, version=None): """ Returns a boolean if the user in the request has edit permission for the object. Can also be passed a version object to check if the user has permission to edit a version of the object (if they own it). """ ...
python
def has_edit_permission(self, request, obj=None, version=None): """ Returns a boolean if the user in the request has edit permission for the object. Can also be passed a version object to check if the user has permission to edit a version of the object (if they own it). """ ...
[ "def", "has_edit_permission", "(", "self", ",", "request", ",", "obj", "=", "None", ",", "version", "=", "None", ")", ":", "# Has the edit permission for this object type", "permission_name", "=", "'{}.edit_{}'", ".", "format", "(", "self", ".", "opts", ".", "ap...
Returns a boolean if the user in the request has edit permission for the object. Can also be passed a version object to check if the user has permission to edit a version of the object (if they own it).
[ "Returns", "a", "boolean", "if", "the", "user", "in", "the", "request", "has", "edit", "permission", "for", "the", "object", "." ]
train
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/admin.py#L120-L139
developersociety/django-glitter
glitter/admin.py
GlitterAdminMixin.has_publish_permission
def has_publish_permission(self, request, obj=None): """ Returns a boolean if the user in the request has publish permission for the object. """ permission_name = '{}.publish_{}'.format(self.opts.app_label, self.opts.model_name) has_permission = request.user.has_perm(permission_n...
python
def has_publish_permission(self, request, obj=None): """ Returns a boolean if the user in the request has publish permission for the object. """ permission_name = '{}.publish_{}'.format(self.opts.app_label, self.opts.model_name) has_permission = request.user.has_perm(permission_n...
[ "def", "has_publish_permission", "(", "self", ",", "request", ",", "obj", "=", "None", ")", ":", "permission_name", "=", "'{}.publish_{}'", ".", "format", "(", "self", ".", "opts", ".", "app_label", ",", "self", ".", "opts", ".", "model_name", ")", "has_pe...
Returns a boolean if the user in the request has publish permission for the object.
[ "Returns", "a", "boolean", "if", "the", "user", "in", "the", "request", "has", "publish", "permission", "for", "the", "object", "." ]
train
https://github.com/developersociety/django-glitter/blob/2c0280ec83afee80deee94ee3934fc54239c2e87/glitter/admin.py#L141-L151
quantmind/agile-toolkit
agiletoolkit/utils.py
semantic_version
def semantic_version(tag): """Get a valid semantic version for tag """ try: version = list(map(int, tag.split('.'))) assert len(version) == 3 return tuple(version) except Exception as exc: raise CommandError( 'Could not parse "%s", please use ' 'MA...
python
def semantic_version(tag): """Get a valid semantic version for tag """ try: version = list(map(int, tag.split('.'))) assert len(version) == 3 return tuple(version) except Exception as exc: raise CommandError( 'Could not parse "%s", please use ' 'MA...
[ "def", "semantic_version", "(", "tag", ")", ":", "try", ":", "version", "=", "list", "(", "map", "(", "int", ",", "tag", ".", "split", "(", "'.'", ")", ")", ")", "assert", "len", "(", "version", ")", "==", "3", "return", "tuple", "(", "version", ...
Get a valid semantic version for tag
[ "Get", "a", "valid", "semantic", "version", "for", "tag" ]
train
https://github.com/quantmind/agile-toolkit/blob/96028e36a842c57b171907c20583a60d1045fec1/agiletoolkit/utils.py#L99-L110
davidblaisonneau-orange/foreman
foreman/item.py
ForemanItem.load
def load(self, data): """ Function load Store the object data """ self.clear() self.update(data) self.enhance()
python
def load(self, data): """ Function load Store the object data """ self.clear() self.update(data) self.enhance()
[ "def", "load", "(", "self", ",", "data", ")", ":", "self", ".", "clear", "(", ")", "self", ".", "update", "(", "data", ")", "self", ".", "enhance", "(", ")" ]
Function load Store the object data
[ "Function", "load", "Store", "the", "object", "data" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/item.py#L53-L59
davidblaisonneau-orange/foreman
foreman/item.py
ForemanItem.enhance
def enhance(self): """ Function enhance Enhance the object with new item or enhanced items """ if self.objName in ['hosts', 'hostgroups', 'puppet_classes']: from foreman.itemSmartClassParameter\ import ItemSmartClassParameter ...
python
def enhance(self): """ Function enhance Enhance the object with new item or enhanced items """ if self.objName in ['hosts', 'hostgroups', 'puppet_classes']: from foreman.itemSmartClassParameter\ import ItemSmartClassParameter ...
[ "def", "enhance", "(", "self", ")", ":", "if", "self", ".", "objName", "in", "[", "'hosts'", ",", "'hostgroups'", ",", "'puppet_classes'", "]", ":", "from", "foreman", ".", "itemSmartClassParameter", "import", "ItemSmartClassParameter", "self", ".", "update", ...
Function enhance Enhance the object with new item or enhanced items
[ "Function", "enhance", "Enhance", "the", "object", "with", "new", "item", "or", "enhanced", "items" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/item.py#L61-L72
davidblaisonneau-orange/foreman
foreman/item.py
ForemanItem.reload
def reload(self): """ Function reload Sync the full object """ self.load(self.api.get(self.objName, self.key))
python
def reload(self): """ Function reload Sync the full object """ self.load(self.api.get(self.objName, self.key))
[ "def", "reload", "(", "self", ")", ":", "self", ".", "load", "(", "self", ".", "api", ".", "get", "(", "self", ".", "objName", ",", "self", ".", "key", ")", ")" ]
Function reload Sync the full object
[ "Function", "reload", "Sync", "the", "full", "object" ]
train
https://github.com/davidblaisonneau-orange/foreman/blob/acb8fd8d74657cfac3b25c82e9c6028b93eb6c92/foreman/item.py#L74-L78