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 |
|---|---|---|---|---|---|---|---|---|---|---|
edeposit/edeposit.amqp.harvester | src/edeposit/amqp/harvester/scrappers/grada_cz.py | _process_book | def _process_book(html_chunk):
"""
Parse available informations about book from the book details page.
Args:
html_chunk (obj): HTMLElement containing slice of the page with
details.
Returns:
obj: :class:`structures.Publication` instance with book details.
... | python | def _process_book(html_chunk):
"""
Parse available informations about book from the book details page.
Args:
html_chunk (obj): HTMLElement containing slice of the page with
details.
Returns:
obj: :class:`structures.Publication` instance with book details.
... | [
"def",
"_process_book",
"(",
"html_chunk",
")",
":",
"title",
",",
"url",
"=",
"_parse_title_url",
"(",
"html_chunk",
")",
"book_format",
",",
"pages",
",",
"isbn",
"=",
"_parse_format_pages_isbn",
"(",
"html_chunk",
")",
"# required informations",
"pub",
"=",
"... | Parse available informations about book from the book details page.
Args:
html_chunk (obj): HTMLElement containing slice of the page with
details.
Returns:
obj: :class:`structures.Publication` instance with book details. | [
"Parse",
"available",
"informations",
"about",
"book",
"from",
"the",
"book",
"details",
"page",
"."
] | train | https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/scrappers/grada_cz.py#L209-L239 |
radjkarl/appBase | appbase/MultiWorkspaceWindow.py | MultiWorkspaceWindow.workspaces | def workspaces(self, index=None):
"""return generator for all all workspace instances"""
c = self.centralWidget()
if index is None:
return (c.widget(n) for n in range(c.count()))
else:
return c.widget(index) | python | def workspaces(self, index=None):
"""return generator for all all workspace instances"""
c = self.centralWidget()
if index is None:
return (c.widget(n) for n in range(c.count()))
else:
return c.widget(index) | [
"def",
"workspaces",
"(",
"self",
",",
"index",
"=",
"None",
")",
":",
"c",
"=",
"self",
".",
"centralWidget",
"(",
")",
"if",
"index",
"is",
"None",
":",
"return",
"(",
"c",
".",
"widget",
"(",
"n",
")",
"for",
"n",
"in",
"range",
"(",
"c",
".... | return generator for all all workspace instances | [
"return",
"generator",
"for",
"all",
"all",
"workspace",
"instances"
] | train | https://github.com/radjkarl/appBase/blob/72b514e6dee7c083f01a2d0b2cc93d46df55bdcb/appbase/MultiWorkspaceWindow.py#L77-L83 |
zyga/call | examples/example2.py | validate | def validate(func):
"""
Check if annotated function arguments validate according to spec
"""
call = PythonCall(func)
@wraps(func)
def decorator(*args, **kwargs):
parameters = call.bind(args, kwargs)
for arg_name, validator in func.__annotations__.items():
if not vali... | python | def validate(func):
"""
Check if annotated function arguments validate according to spec
"""
call = PythonCall(func)
@wraps(func)
def decorator(*args, **kwargs):
parameters = call.bind(args, kwargs)
for arg_name, validator in func.__annotations__.items():
if not vali... | [
"def",
"validate",
"(",
"func",
")",
":",
"call",
"=",
"PythonCall",
"(",
"func",
")",
"@",
"wraps",
"(",
"func",
")",
"def",
"decorator",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"parameters",
"=",
"call",
".",
"bind",
"(",
"args",
"... | Check if annotated function arguments validate according to spec | [
"Check",
"if",
"annotated",
"function",
"arguments",
"validate",
"according",
"to",
"spec"
] | train | https://github.com/zyga/call/blob/dcef9a5aac7f9085bd4829dd6bcedc5fc2945d87/examples/example2.py#L20-L34 |
spookey/photon | photon/tools/template.py | Template.sub | def sub(self):
'''
:param fields:
Set fields to substitute
:returns:
Substituted Template with given fields.
If no fields were set up beforehand, :func:`raw` is used.
'''
if self.__fields:
return _Template(self.raw).substitute(self... | python | def sub(self):
'''
:param fields:
Set fields to substitute
:returns:
Substituted Template with given fields.
If no fields were set up beforehand, :func:`raw` is used.
'''
if self.__fields:
return _Template(self.raw).substitute(self... | [
"def",
"sub",
"(",
"self",
")",
":",
"if",
"self",
".",
"__fields",
":",
"return",
"_Template",
"(",
"self",
".",
"raw",
")",
".",
"substitute",
"(",
"self",
".",
"__fields",
")",
"return",
"self",
".",
"raw"
] | :param fields:
Set fields to substitute
:returns:
Substituted Template with given fields.
If no fields were set up beforehand, :func:`raw` is used. | [
":",
"param",
"fields",
":",
"Set",
"fields",
"to",
"substitute",
":",
"returns",
":",
"Substituted",
"Template",
"with",
"given",
"fields",
".",
"If",
"no",
"fields",
"were",
"set",
"up",
"beforehand",
":",
"func",
":",
"raw",
"is",
"used",
"."
] | train | https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/tools/template.py#L57-L68 |
spookey/photon | photon/tools/template.py | Template.write | def write(self, filename, append=True, backup=True):
'''
:param filename:
File to write into
:param append:
Either append to existing content (if not already included)
or completely replace `filename`
:param backup:
Create a backup of `file... | python | def write(self, filename, append=True, backup=True):
'''
:param filename:
File to write into
:param append:
Either append to existing content (if not already included)
or completely replace `filename`
:param backup:
Create a backup of `file... | [
"def",
"write",
"(",
"self",
",",
"filename",
",",
"append",
"=",
"True",
",",
"backup",
"=",
"True",
")",
":",
"res",
"=",
"self",
".",
"sub",
"if",
"append",
":",
"org",
"=",
"read_file",
"(",
"filename",
")",
"if",
"org",
":",
"if",
"res",
"in... | :param filename:
File to write into
:param append:
Either append to existing content (if not already included)
or completely replace `filename`
:param backup:
Create a backup of `filename` before writing.
Only applies when `append` is set | [
":",
"param",
"filename",
":",
"File",
"to",
"write",
"into",
":",
"param",
"append",
":",
"Either",
"append",
"to",
"existing",
"content",
"(",
"if",
"not",
"already",
"included",
")",
"or",
"completely",
"replace",
"filename",
":",
"param",
"backup",
":"... | train | https://github.com/spookey/photon/blob/57212a26ce713ab7723910ee49e3d0ba1697799f/photon/tools/template.py#L78-L105 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | expression_type | def expression_type(con, topx, ex):
"take a BaseX descendant from sqparse2, return a type class from above"
if isinstance(ex,sqparse2.Literal):
if isinstance(ex.val,basestring): return STRING
else: raise NotImplementedError('literal', type(ex.val))
elif isinstance(ex,sqparse2.AttrX):
if ex.parent.name... | python | def expression_type(con, topx, ex):
"take a BaseX descendant from sqparse2, return a type class from above"
if isinstance(ex,sqparse2.Literal):
if isinstance(ex.val,basestring): return STRING
else: raise NotImplementedError('literal', type(ex.val))
elif isinstance(ex,sqparse2.AttrX):
if ex.parent.name... | [
"def",
"expression_type",
"(",
"con",
",",
"topx",
",",
"ex",
")",
":",
"if",
"isinstance",
"(",
"ex",
",",
"sqparse2",
".",
"Literal",
")",
":",
"if",
"isinstance",
"(",
"ex",
".",
"val",
",",
"basestring",
")",
":",
"return",
"STRING",
"else",
":",... | take a BaseX descendant from sqparse2, return a type class from above | [
"take",
"a",
"BaseX",
"descendant",
"from",
"sqparse2",
"return",
"a",
"type",
"class",
"from",
"above"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L55-L71 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | open_only | def open_only(f):
"decorator"
@functools.wraps(f)
def f2(self, *args, **kwargs):
if self.closed: raise NotSupportedError('connection is closed')
return f(self, *args, **kwargs)
return f2 | python | def open_only(f):
"decorator"
@functools.wraps(f)
def f2(self, *args, **kwargs):
if self.closed: raise NotSupportedError('connection is closed')
return f(self, *args, **kwargs)
return f2 | [
"def",
"open_only",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"f2",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"closed",
":",
"raise",
"NotSupportedError",
"(",
"'connection ... | decorator | [
"decorator"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L134-L140 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | call_cur | def call_cur(f):
"decorator for opening a connection and passing a cursor to the function"
@functools.wraps(f)
def f2(self, *args, **kwargs):
with self.withcur() as cur:
return f(self, cur, *args, **kwargs)
return f2 | python | def call_cur(f):
"decorator for opening a connection and passing a cursor to the function"
@functools.wraps(f)
def f2(self, *args, **kwargs):
with self.withcur() as cur:
return f(self, cur, *args, **kwargs)
return f2 | [
"def",
"call_cur",
"(",
"f",
")",
":",
"@",
"functools",
".",
"wraps",
"(",
"f",
")",
"def",
"f2",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"self",
".",
"withcur",
"(",
")",
"as",
"cur",
":",
"return",
"f",
"(... | decorator for opening a connection and passing a cursor to the function | [
"decorator",
"for",
"opening",
"a",
"connection",
"and",
"passing",
"a",
"cursor",
"to",
"the",
"function"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L195-L201 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | Cursor.description | def description(self):
"this is only a property so it can raise; make it an attr once it works"
if self.lastx is None: return
if type(self.lastx) not in (sqparse2.SelectX,sqparse2.UpdateX,sqparse2.InsertX): return
if type(self.lastx) in (sqparse2.UpdateX,sqparse2.InsertX) and self.lastx.ret is None: ret... | python | def description(self):
"this is only a property so it can raise; make it an attr once it works"
if self.lastx is None: return
if type(self.lastx) not in (sqparse2.SelectX,sqparse2.UpdateX,sqparse2.InsertX): return
if type(self.lastx) in (sqparse2.UpdateX,sqparse2.InsertX) and self.lastx.ret is None: ret... | [
"def",
"description",
"(",
"self",
")",
":",
"if",
"self",
".",
"lastx",
"is",
"None",
":",
"return",
"if",
"type",
"(",
"self",
".",
"lastx",
")",
"not",
"in",
"(",
"sqparse2",
".",
"SelectX",
",",
"sqparse2",
".",
"UpdateX",
",",
"sqparse2",
".",
... | this is only a property so it can raise; make it an attr once it works | [
"this",
"is",
"only",
"a",
"property",
"so",
"it",
"can",
"raise",
";",
"make",
"it",
"an",
"attr",
"once",
"it",
"works"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L93-L102 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | PgPoolMock.select | def select(self, cursor, qstring, vals=()):
"careful: don't pass cursor (it's from decorator)"
cursor.execute(qstring, vals) # hmm; do I not want to commit at the end of this?
return cursor.fetchall() | python | def select(self, cursor, qstring, vals=()):
"careful: don't pass cursor (it's from decorator)"
cursor.execute(qstring, vals) # hmm; do I not want to commit at the end of this?
return cursor.fetchall() | [
"def",
"select",
"(",
"self",
",",
"cursor",
",",
"qstring",
",",
"vals",
"=",
"(",
")",
")",
":",
"cursor",
".",
"execute",
"(",
"qstring",
",",
"vals",
")",
"# hmm; do I not want to commit at the end of this?",
"return",
"cursor",
".",
"fetchall",
"(",
")"... | careful: don't pass cursor (it's from decorator) | [
"careful",
":",
"don",
"t",
"pass",
"cursor",
"(",
"it",
"s",
"from",
"decorator",
")"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L209-L212 |
abe-winter/pg13-py | pg13/pgmock_dbapi2.py | PgPoolMock.commitreturn | def commitreturn(self, cursor, qstring, vals=()):
"careful: don't pass cursor (it's from decorator)"
cursor.execute(qstring, vals)
return cursor.fetchall()[0] | python | def commitreturn(self, cursor, qstring, vals=()):
"careful: don't pass cursor (it's from decorator)"
cursor.execute(qstring, vals)
return cursor.fetchall()[0] | [
"def",
"commitreturn",
"(",
"self",
",",
"cursor",
",",
"qstring",
",",
"vals",
"=",
"(",
")",
")",
":",
"cursor",
".",
"execute",
"(",
"qstring",
",",
"vals",
")",
"return",
"cursor",
".",
"fetchall",
"(",
")",
"[",
"0",
"]"
] | careful: don't pass cursor (it's from decorator) | [
"careful",
":",
"don",
"t",
"pass",
"cursor",
"(",
"it",
"s",
"from",
"decorator",
")"
] | train | https://github.com/abe-winter/pg13-py/blob/c78806f99f35541a8756987e86edca3438aa97f5/pg13/pgmock_dbapi2.py#L218-L221 |
KnowledgeLinks/rdfframework | rdfframework/utilities/mapreduce.py | SimpleMapReduce.partition | def partition(self, mapped_values):
"""Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values.
"""
partitioned_data = collections.defaultdict(list)
for key, value in mapped_values:
partitioned_data[key].appe... | python | def partition(self, mapped_values):
"""Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values.
"""
partitioned_data = collections.defaultdict(list)
for key, value in mapped_values:
partitioned_data[key].appe... | [
"def",
"partition",
"(",
"self",
",",
"mapped_values",
")",
":",
"partitioned_data",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"for",
"key",
",",
"value",
"in",
"mapped_values",
":",
"partitioned_data",
"[",
"key",
"]",
".",
"append",
"(",
... | Organize the mapped values by their key.
Returns an unsorted sequence of tuples with a key and a sequence of values. | [
"Organize",
"the",
"mapped",
"values",
"by",
"their",
"key",
".",
"Returns",
"an",
"unsorted",
"sequence",
"of",
"tuples",
"with",
"a",
"key",
"and",
"a",
"sequence",
"of",
"values",
"."
] | train | https://github.com/KnowledgeLinks/rdfframework/blob/9ec32dcc4bed51650a4b392cc5c15100fef7923a/rdfframework/utilities/mapreduce.py#L31-L38 |
emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.pre | def pre(self, command, output_dir, kw):
"""
Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files
"""
# Build a random secret_key
chars = u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
kw['secret_ke... | python | def pre(self, command, output_dir, kw):
"""
Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files
"""
# Build a random secret_key
chars = u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'
kw['secret_ke... | [
"def",
"pre",
"(",
"self",
",",
"command",
",",
"output_dir",
",",
"kw",
")",
":",
"# Build a random secret_key",
"chars",
"=",
"u'abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)'",
"kw",
"[",
"'secret_key'",
"]",
"=",
"''",
".",
"join",
"(",
"[",
"choice",
"... | Prepare some context before install
Added kwargs in ``kw`` will be accessible into paste template files | [
"Prepare",
"some",
"context",
"before",
"install",
"Added",
"kwargs",
"in",
"kw",
"will",
"be",
"accessible",
"into",
"paste",
"template",
"files"
] | train | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L63-L75 |
emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.get_mods | def get_mods(self, project_path, vars):
"""
Build the mod list to enable
"""
# Start with answers from interactive command
mods = [var.name for var in self.vars if vars[var.name].lower() == 'yes']
mods = set(mods)
# Base mods
for name in self.mods_list:
... | python | def get_mods(self, project_path, vars):
"""
Build the mod list to enable
"""
# Start with answers from interactive command
mods = [var.name for var in self.vars if vars[var.name].lower() == 'yes']
mods = set(mods)
# Base mods
for name in self.mods_list:
... | [
"def",
"get_mods",
"(",
"self",
",",
"project_path",
",",
"vars",
")",
":",
"# Start with answers from interactive command",
"mods",
"=",
"[",
"var",
".",
"name",
"for",
"var",
"in",
"self",
".",
"vars",
"if",
"vars",
"[",
"var",
".",
"name",
"]",
".",
"... | Build the mod list to enable | [
"Build",
"the",
"mod",
"list",
"to",
"enable"
] | train | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L77-L94 |
emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.get_symlinks | def get_symlinks(self, project_path, vars, mods):
"""
Build the symlink list to create (to enable mods and other stuff)
"""
# Some additional symlinks
if 'cms' in mods:
# Mirroring Ckeditor JS overrides for the CKEditor cmsplugin that
# use a different na... | python | def get_symlinks(self, project_path, vars, mods):
"""
Build the symlink list to create (to enable mods and other stuff)
"""
# Some additional symlinks
if 'cms' in mods:
# Mirroring Ckeditor JS overrides for the CKEditor cmsplugin that
# use a different na... | [
"def",
"get_symlinks",
"(",
"self",
",",
"project_path",
",",
"vars",
",",
"mods",
")",
":",
"# Some additional symlinks",
"if",
"'cms'",
"in",
"mods",
":",
"# Mirroring Ckeditor JS overrides for the CKEditor cmsplugin that ",
"# use a different namespace than 'django-ckeditor'... | Build the symlink list to create (to enable mods and other stuff) | [
"Build",
"the",
"symlink",
"list",
"to",
"create",
"(",
"to",
"enable",
"mods",
"and",
"other",
"stuff",
")"
] | train | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L96-L114 |
emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/templates.py | Django.post | def post(self, command, output_dir, vars):
"""
Do some tasks after install
"""
if command.simulate:
return
# Find the 'project/' dir in the created paste project
project_path = join(getcwd(), vars['project'], 'project')
# 1. Mods
... | python | def post(self, command, output_dir, vars):
"""
Do some tasks after install
"""
if command.simulate:
return
# Find the 'project/' dir in the created paste project
project_path = join(getcwd(), vars['project'], 'project')
# 1. Mods
... | [
"def",
"post",
"(",
"self",
",",
"command",
",",
"output_dir",
",",
"vars",
")",
":",
"if",
"command",
".",
"simulate",
":",
"return",
"# Find the 'project/' dir in the created paste project",
"project_path",
"=",
"join",
"(",
"getcwd",
"(",
")",
",",
"vars",
... | Do some tasks after install | [
"Do",
"some",
"tasks",
"after",
"install"
] | train | https://github.com/emencia/emencia_paste_djangocms_3/blob/29eabbcb17e21996a6e1d99592fc719dc8833b59/emencia_paste_djangocms_3/templates.py#L116-L138 |
knagra/farnsworth | base/redirects.py | red_ext | def red_ext(request, message=None):
'''
The external landing.
Also a convenience function for redirecting users who don't have site access to the external page.
Parameters:
request - the request in the calling function
message - a message from the caller function
'''
if message:
... | python | def red_ext(request, message=None):
'''
The external landing.
Also a convenience function for redirecting users who don't have site access to the external page.
Parameters:
request - the request in the calling function
message - a message from the caller function
'''
if message:
... | [
"def",
"red_ext",
"(",
"request",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
":",
"messages",
".",
"add_message",
"(",
"request",
",",
"messages",
".",
"ERROR",
",",
"message",
")",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'exte... | The external landing.
Also a convenience function for redirecting users who don't have site access to the external page.
Parameters:
request - the request in the calling function
message - a message from the caller function | [
"The",
"external",
"landing",
".",
"Also",
"a",
"convenience",
"function",
"for",
"redirecting",
"users",
"who",
"don",
"t",
"have",
"site",
"access",
"to",
"the",
"external",
"page",
".",
"Parameters",
":",
"request",
"-",
"the",
"request",
"in",
"the",
"... | train | https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/redirects.py#L11-L21 |
knagra/farnsworth | base/redirects.py | red_home | def red_home(request, message=None):
'''
Convenience function for redirecting users who don't have access to a page to the home page.
Parameters:
request - the request in the calling function
message - a message from the caller function
'''
if message:
messages.add_message(re... | python | def red_home(request, message=None):
'''
Convenience function for redirecting users who don't have access to a page to the home page.
Parameters:
request - the request in the calling function
message - a message from the caller function
'''
if message:
messages.add_message(re... | [
"def",
"red_home",
"(",
"request",
",",
"message",
"=",
"None",
")",
":",
"if",
"message",
":",
"messages",
".",
"add_message",
"(",
"request",
",",
"messages",
".",
"ERROR",
",",
"message",
")",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'hom... | Convenience function for redirecting users who don't have access to a page to the home page.
Parameters:
request - the request in the calling function
message - a message from the caller function | [
"Convenience",
"function",
"for",
"redirecting",
"users",
"who",
"don",
"t",
"have",
"access",
"to",
"a",
"page",
"to",
"the",
"home",
"page",
".",
"Parameters",
":",
"request",
"-",
"the",
"request",
"in",
"the",
"calling",
"function",
"message",
"-",
"a"... | train | https://github.com/knagra/farnsworth/blob/1b6589f0d9fea154f0a1e2231ed906764ed26d26/base/redirects.py#L23-L32 |
dugan/coverage-reporter | coverage_reporter/collectors/base.py | _iter_full_paths | def _iter_full_paths(path_list):
"""
Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths.
"""
for path in path_list:
if not os.path.isdir(path):
full_path = os.path.realpath(path)
yield path
else:
... | python | def _iter_full_paths(path_list):
"""
Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths.
"""
for path in path_list:
if not os.path.isdir(path):
full_path = os.path.realpath(path)
yield path
else:
... | [
"def",
"_iter_full_paths",
"(",
"path_list",
")",
":",
"for",
"path",
"in",
"path_list",
":",
"if",
"not",
"os",
".",
"path",
".",
"isdir",
"(",
"path",
")",
":",
"full_path",
"=",
"os",
".",
"path",
".",
"realpath",
"(",
"path",
")",
"yield",
"path"... | Iterates over all paths that are in a directory and its subdirectory, returning
fully-specified paths. | [
"Iterates",
"over",
"all",
"paths",
"that",
"are",
"in",
"a",
"directory",
"and",
"its",
"subdirectory",
"returning",
"fully",
"-",
"specified",
"paths",
"."
] | train | https://github.com/dugan/coverage-reporter/blob/18ecc9189de4f62b15366901b2451b8047f1ccfb/coverage_reporter/collectors/base.py#L53-L66 |
Jokymon/binstruct | binstruct.py | big_endian | def big_endian(original_class):
"""The big_endian function is a class decorator for classes derived from
:class:`.StructTemplate`. By default a StructTemplate class interpretes its
fields in little endian format. Using this decorator you change this
behavior.
:param original_class: The class you wa... | python | def big_endian(original_class):
"""The big_endian function is a class decorator for classes derived from
:class:`.StructTemplate`. By default a StructTemplate class interpretes its
fields in little endian format. Using this decorator you change this
behavior.
:param original_class: The class you wa... | [
"def",
"big_endian",
"(",
"original_class",
")",
":",
"orig_init",
"=",
"original_class",
".",
"__init__",
"def",
"__init__",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"orig_init",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
... | The big_endian function is a class decorator for classes derived from
:class:`.StructTemplate`. By default a StructTemplate class interpretes its
fields in little endian format. Using this decorator you change this
behavior.
:param original_class: The class you want to turn into a big endian
... | [
"The",
"big_endian",
"function",
"is",
"a",
"class",
"decorator",
"for",
"classes",
"derived",
"from",
":",
"class",
":",
".",
"StructTemplate",
".",
"By",
"default",
"a",
"StructTemplate",
"class",
"interpretes",
"its",
"fields",
"in",
"little",
"endian",
"fo... | train | https://github.com/Jokymon/binstruct/blob/d42248294f819b39e93d8985041387db3ee7c1af/binstruct.py#L19-L34 |
davisd50/sparc.config | sparc/config/verify.py | verify_config_container | def verify_config_container(object_):
"""Verify object is a valid config container
Valid config containers provide zope.interface.common.mapping.IEnumerableMapping
or an iterable of zope.interface.common.mapping.IEnumerableMapping.
verification is performed by checking required interfaces attr... | python | def verify_config_container(object_):
"""Verify object is a valid config container
Valid config containers provide zope.interface.common.mapping.IEnumerableMapping
or an iterable of zope.interface.common.mapping.IEnumerableMapping.
verification is performed by checking required interfaces attr... | [
"def",
"verify_config_container",
"(",
"object_",
")",
":",
"try",
":",
"#check for a map",
"_verify_map",
"(",
"object_",
")",
"except",
"BrokenImplementation",
"as",
"e",
":",
"#check for a iterable of maps",
"try",
":",
"for",
"m",
"in",
"object_",
":",
"_verif... | Verify object is a valid config container
Valid config containers provide zope.interface.common.mapping.IEnumerableMapping
or an iterable of zope.interface.common.mapping.IEnumerableMapping.
verification is performed by checking required interfaces attributes
against those provided by object_... | [
"Verify",
"object",
"is",
"a",
"valid",
"config",
"container",
"Valid",
"config",
"containers",
"provide",
"zope",
".",
"interface",
".",
"common",
".",
"mapping",
".",
"IEnumerableMapping",
"or",
"an",
"iterable",
"of",
"zope",
".",
"interface",
".",
"common"... | train | https://github.com/davisd50/sparc.config/blob/33b4b59336dce0e9c6ae747836a6555a1f770b9c/sparc/config/verify.py#L11-L32 |
coghost/izen | izen/icfg.py | Conf.__spawn | def __spawn(self):
"""通过手动方式, 指定字段类型与默认值,
- 如果配置文件有变动, 需要手动在这里添加
- 如果配置字段未在这里指出, 则默认为 string, 使用时需要手动转换
"""
dat = {
'log.enabled': False,
'log.file_pth': '{}/{}.log'.format(self._pth, self._cfg_name),
'log.file_backups': 3,
... | python | def __spawn(self):
"""通过手动方式, 指定字段类型与默认值,
- 如果配置文件有变动, 需要手动在这里添加
- 如果配置字段未在这里指出, 则默认为 string, 使用时需要手动转换
"""
dat = {
'log.enabled': False,
'log.file_pth': '{}/{}.log'.format(self._pth, self._cfg_name),
'log.file_backups': 3,
... | [
"def",
"__spawn",
"(",
"self",
")",
":",
"dat",
"=",
"{",
"'log.enabled'",
":",
"False",
",",
"'log.file_pth'",
":",
"'{}/{}.log'",
".",
"format",
"(",
"self",
".",
"_pth",
",",
"self",
".",
"_cfg_name",
")",
",",
"'log.file_backups'",
":",
"3",
",",
"... | 通过手动方式, 指定字段类型与默认值,
- 如果配置文件有变动, 需要手动在这里添加
- 如果配置字段未在这里指出, 则默认为 string, 使用时需要手动转换 | [
"通过手动方式",
"指定字段类型与默认值",
"-",
"如果配置文件有变动",
"需要手动在这里添加",
"-",
"如果配置字段未在这里指出",
"则默认为",
"string",
"使用时需要手动转换"
] | train | https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/icfg.py#L82-L95 |
coghost/izen | izen/icfg.py | Conf.__do_init | def __do_init(self, dat_dict):
"""
使用字典方式来更新到存储文件中
:param dat_dict:
:type dat_dict:
:return:
:rtype:
"""
for k, v in dat_dict.items():
if isinstance(v, dict):
self.cfg.init(k, v['val'], v['proto'])
else:
... | python | def __do_init(self, dat_dict):
"""
使用字典方式来更新到存储文件中
:param dat_dict:
:type dat_dict:
:return:
:rtype:
"""
for k, v in dat_dict.items():
if isinstance(v, dict):
self.cfg.init(k, v['val'], v['proto'])
else:
... | [
"def",
"__do_init",
"(",
"self",
",",
"dat_dict",
")",
":",
"for",
"k",
",",
"v",
"in",
"dat_dict",
".",
"items",
"(",
")",
":",
"if",
"isinstance",
"(",
"v",
",",
"dict",
")",
":",
"self",
".",
"cfg",
".",
"init",
"(",
"k",
",",
"v",
"[",
"'... | 使用字典方式来更新到存储文件中
:param dat_dict:
:type dat_dict:
:return:
:rtype: | [
"使用字典方式来更新到存储文件中",
":",
"param",
"dat_dict",
":",
":",
"type",
"dat_dict",
":",
":",
"return",
":",
":",
"rtype",
":"
] | train | https://github.com/coghost/izen/blob/432db017f99dd2ba809e1ba1792145ab6510263d/izen/icfg.py#L97-L110 |
f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline.c | def c(self):
"""Caching client for not repeapting checks"""
if self._client is None:
self._parse_settings()
self._client = Rumetr(**self.settings)
return self._client | python | def c(self):
"""Caching client for not repeapting checks"""
if self._client is None:
self._parse_settings()
self._client = Rumetr(**self.settings)
return self._client | [
"def",
"c",
"(",
"self",
")",
":",
"if",
"self",
".",
"_client",
"is",
"None",
":",
"self",
".",
"_parse_settings",
"(",
")",
"self",
".",
"_client",
"=",
"Rumetr",
"(",
"*",
"*",
"self",
".",
"settings",
")",
"return",
"self",
".",
"_client"
] | Caching client for not repeapting checks | [
"Caching",
"client",
"for",
"not",
"repeapting",
"checks"
] | train | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L81-L86 |
f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline._parse_settings | def _parse_settings(self):
"""Gets upload options from the scrapy settings"""
if hasattr(self, 'settings'): # parse setting only one time
return
self.settings = {
'auth_key': self._check_required_setting('RUMETR_TOKEN'),
'developer': self._check_required_set... | python | def _parse_settings(self):
"""Gets upload options from the scrapy settings"""
if hasattr(self, 'settings'): # parse setting only one time
return
self.settings = {
'auth_key': self._check_required_setting('RUMETR_TOKEN'),
'developer': self._check_required_set... | [
"def",
"_parse_settings",
"(",
"self",
")",
":",
"if",
"hasattr",
"(",
"self",
",",
"'settings'",
")",
":",
"# parse setting only one time",
"return",
"self",
".",
"settings",
"=",
"{",
"'auth_key'",
":",
"self",
".",
"_check_required_setting",
"(",
"'RUMETR_TOK... | Gets upload options from the scrapy settings | [
"Gets",
"upload",
"options",
"from",
"the",
"scrapy",
"settings"
] | train | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L88-L97 |
f213/rumetr-client | rumetr/scrapy/pipeline.py | UploadPipeline._parse_deadline | def _parse_deadline(deadline):
"""Translate deadline date from human-acceptable format to the machine-acceptable"""
if '-' in deadline and len(deadline) == 10:
return deadline
if '.' in deadline and len(deadline) == 10: # russian format dd.mm.yyyy to yyyy-mm-dd
dmy = de... | python | def _parse_deadline(deadline):
"""Translate deadline date from human-acceptable format to the machine-acceptable"""
if '-' in deadline and len(deadline) == 10:
return deadline
if '.' in deadline and len(deadline) == 10: # russian format dd.mm.yyyy to yyyy-mm-dd
dmy = de... | [
"def",
"_parse_deadline",
"(",
"deadline",
")",
":",
"if",
"'-'",
"in",
"deadline",
"and",
"len",
"(",
"deadline",
")",
"==",
"10",
":",
"return",
"deadline",
"if",
"'.'",
"in",
"deadline",
"and",
"len",
"(",
"deadline",
")",
"==",
"10",
":",
"# russia... | Translate deadline date from human-acceptable format to the machine-acceptable | [
"Translate",
"deadline",
"date",
"from",
"human",
"-",
"acceptable",
"format",
"to",
"the",
"machine",
"-",
"acceptable"
] | train | https://github.com/f213/rumetr-client/blob/5180152bcb2eed8246b88035db7c0bb1fe603166/rumetr/scrapy/pipeline.py#L109-L119 |
tylerbutler/propane | propane/paths.py | ensure_exists | def ensure_exists(p, assume_dirs=False):
"""
Ensures a given path *p* exists.
If a path to a file is passed in, then the path to the file will be checked. This can be overridden by passing a
value of ``True`` to ``assume_dirs``, in which case the paths will be assumed to be to directories, not files.
... | python | def ensure_exists(p, assume_dirs=False):
"""
Ensures a given path *p* exists.
If a path to a file is passed in, then the path to the file will be checked. This can be overridden by passing a
value of ``True`` to ``assume_dirs``, in which case the paths will be assumed to be to directories, not files.
... | [
"def",
"ensure_exists",
"(",
"p",
",",
"assume_dirs",
"=",
"False",
")",
":",
"if",
"Path",
"(",
"p",
")",
".",
"ext",
"and",
"not",
"assume_dirs",
":",
"Path",
"(",
"p",
")",
".",
"dirname",
"(",
")",
".",
"makedirs_p",
"(",
")",
"else",
":",
"P... | Ensures a given path *p* exists.
If a path to a file is passed in, then the path to the file will be checked. This can be overridden by passing a
value of ``True`` to ``assume_dirs``, in which case the paths will be assumed to be to directories, not files. | [
"Ensures",
"a",
"given",
"path",
"*",
"p",
"*",
"exists",
"."
] | train | https://github.com/tylerbutler/propane/blob/6c404285ab8d78865b7175a5c8adf8fae12d6be5/propane/paths.py#L35-L46 |
tylerbutler/propane | propane/paths.py | expand_path | def expand_path(path_list, root_path=None):
"""
Given a list of paths, returns a list of all parent paths (including the original paths).
If provided, ``root_path`` is used as the outermost path when expanding parent paths. If path_list contains
paths to files, only the directories where those files exi... | python | def expand_path(path_list, root_path=None):
"""
Given a list of paths, returns a list of all parent paths (including the original paths).
If provided, ``root_path`` is used as the outermost path when expanding parent paths. If path_list contains
paths to files, only the directories where those files exi... | [
"def",
"expand_path",
"(",
"path_list",
",",
"root_path",
"=",
"None",
")",
":",
"to_return",
"=",
"set",
"(",
")",
"path_list",
"=",
"wrap_list",
"(",
"path_list",
")",
"# expand ignore list to include all directories as individual entries",
"for",
"p",
"in",
"path... | Given a list of paths, returns a list of all parent paths (including the original paths).
If provided, ``root_path`` is used as the outermost path when expanding parent paths. If path_list contains
paths to files, only the directories where those files exist will be returned. This function only returns paths
... | [
"Given",
"a",
"list",
"of",
"paths",
"returns",
"a",
"list",
"of",
"all",
"parent",
"paths",
"(",
"including",
"the",
"original",
"paths",
")",
".",
"If",
"provided",
"root_path",
"is",
"used",
"as",
"the",
"outermost",
"path",
"when",
"expanding",
"parent... | train | https://github.com/tylerbutler/propane/blob/6c404285ab8d78865b7175a5c8adf8fae12d6be5/propane/paths.py#L49-L85 |
tylerbutler/propane | propane/paths.py | has_files | def has_files(the_path):
"""Given a path, returns whether the path has any files in it or any subfolders. Works recursively."""
the_path = Path(the_path)
try:
for _ in the_path.walkfiles():
return True
return False
except OSError as ex:
if ex.errno == errno.ENOENT:
... | python | def has_files(the_path):
"""Given a path, returns whether the path has any files in it or any subfolders. Works recursively."""
the_path = Path(the_path)
try:
for _ in the_path.walkfiles():
return True
return False
except OSError as ex:
if ex.errno == errno.ENOENT:
... | [
"def",
"has_files",
"(",
"the_path",
")",
":",
"the_path",
"=",
"Path",
"(",
"the_path",
")",
"try",
":",
"for",
"_",
"in",
"the_path",
".",
"walkfiles",
"(",
")",
":",
"return",
"True",
"return",
"False",
"except",
"OSError",
"as",
"ex",
":",
"if",
... | Given a path, returns whether the path has any files in it or any subfolders. Works recursively. | [
"Given",
"a",
"path",
"returns",
"whether",
"the",
"path",
"has",
"any",
"files",
"in",
"it",
"or",
"any",
"subfolders",
".",
"Works",
"recursively",
"."
] | train | https://github.com/tylerbutler/propane/blob/6c404285ab8d78865b7175a5c8adf8fae12d6be5/propane/paths.py#L88-L100 |
tylerbutler/propane | propane/paths.py | mirror_folder | def mirror_folder(source, target, delete_orphans=True, recurse=True, ignore_list=None, _level=0, logger=None):
"""Mirrors a folder *source* into a target folder *target*."""
logger = logger or logging.getLogger(__name__)
def expand_tree(p):
tree = []
for node in Path(p).walk():
... | python | def mirror_folder(source, target, delete_orphans=True, recurse=True, ignore_list=None, _level=0, logger=None):
"""Mirrors a folder *source* into a target folder *target*."""
logger = logger or logging.getLogger(__name__)
def expand_tree(p):
tree = []
for node in Path(p).walk():
... | [
"def",
"mirror_folder",
"(",
"source",
",",
"target",
",",
"delete_orphans",
"=",
"True",
",",
"recurse",
"=",
"True",
",",
"ignore_list",
"=",
"None",
",",
"_level",
"=",
"0",
",",
"logger",
"=",
"None",
")",
":",
"logger",
"=",
"logger",
"or",
"loggi... | Mirrors a folder *source* into a target folder *target*. | [
"Mirrors",
"a",
"folder",
"*",
"source",
"*",
"into",
"a",
"target",
"folder",
"*",
"target",
"*",
"."
] | train | https://github.com/tylerbutler/propane/blob/6c404285ab8d78865b7175a5c8adf8fae12d6be5/propane/paths.py#L103-L186 |
hapylestat/apputils | apputils/settings/ast/cmd.py | DefaultTokenizer.tokenize | def tokenize(cls, obj):
"""
Convert input data to tokens
:type obj list|set|tuple
"""
tokens = {}
try:
token_iterator = cls.make_iterable(obj)
_lang = cls.language_definition()
tokens = {k: [] for k in _lang.argument_types}
prev, current = None, next(token_iterator)
... | python | def tokenize(cls, obj):
"""
Convert input data to tokens
:type obj list|set|tuple
"""
tokens = {}
try:
token_iterator = cls.make_iterable(obj)
_lang = cls.language_definition()
tokens = {k: [] for k in _lang.argument_types}
prev, current = None, next(token_iterator)
... | [
"def",
"tokenize",
"(",
"cls",
",",
"obj",
")",
":",
"tokens",
"=",
"{",
"}",
"try",
":",
"token_iterator",
"=",
"cls",
".",
"make_iterable",
"(",
"obj",
")",
"_lang",
"=",
"cls",
".",
"language_definition",
"(",
")",
"tokens",
"=",
"{",
"k",
":",
... | Convert input data to tokens
:type obj list|set|tuple | [
"Convert",
"input",
"data",
"to",
"tokens"
] | train | https://github.com/hapylestat/apputils/blob/5d185616feda27e6e21273307161471ef11a3518/apputils/settings/ast/cmd.py#L66-L120 |
hapylestat/apputils | apputils/settings/ast/cmd.py | CommandLineAST.parse | def parse(self, argv, tokenizer=DefaultTokenizer):
"""
Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer
"""
args = tokenizer.tokenize(argv)
_lang = tokenizer.language_definition()
#
# for param in self.__args:
# if self._is_default_arg(param)... | python | def parse(self, argv, tokenizer=DefaultTokenizer):
"""
Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer
"""
args = tokenizer.tokenize(argv)
_lang = tokenizer.language_definition()
#
# for param in self.__args:
# if self._is_default_arg(param)... | [
"def",
"parse",
"(",
"self",
",",
"argv",
",",
"tokenizer",
"=",
"DefaultTokenizer",
")",
":",
"args",
"=",
"tokenizer",
".",
"tokenize",
"(",
"argv",
")",
"_lang",
"=",
"tokenizer",
".",
"language_definition",
"(",
")",
"#",
"# for param in self.__args:",
"... | Parse command line to out tree
:type argv object
:type tokenizer AbstractTokenizer | [
"Parse",
"command",
"line",
"to",
"out",
"tree"
] | train | https://github.com/hapylestat/apputils/blob/5d185616feda27e6e21273307161471ef11a3518/apputils/settings/ast/cmd.py#L142-L160 |
kervi/kervi-core | kervi/actions/__init__.py | action | def action(method=None, **kwargs):
"""
Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@a... | python | def action(method=None, **kwargs):
"""
Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@a... | [
"def",
"action",
"(",
"method",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"def",
"action_wrap",
"(",
"f",
")",
":",
"action_id",
"=",
"kwargs",
".",
"get",
"(",
"\"action_id\"",
",",
"f",
".",
"__name__",
")",
"name",
"=",
"kwargs",
".",
"get... | Decorator that turns a function or controller method into an kervi action.
it is possible to call the action in other kervi processes or modules.
@action
def my_action(p)
...
call it via Actions["my_action"](10)
@action(action_id="action_1", name="This is my action... | [
"Decorator",
"that",
"turns",
"a",
"function",
"or",
"controller",
"method",
"into",
"an",
"kervi",
"action",
".",
"it",
"is",
"possible",
"to",
"call",
"the",
"action",
"in",
"other",
"kervi",
"processes",
"or",
"modules",
"."
] | train | https://github.com/kervi/kervi-core/blob/3c1e3c8a17a7b4d085d8a28b99180ff2a96b0e23/kervi/actions/__init__.py#L42-L92 |
b3j0f/conf | b3j0f/conf/model/base.py | ModelElement.copy | def copy(self, *args, **kwargs):
"""Copy this model element and contained elements if they exist."""
for slot in self.__slots__:
attr = getattr(self, slot)
if slot[0] == '_': # convert protected attribute name to public
slot = slot[1:]
if slot not in... | python | def copy(self, *args, **kwargs):
"""Copy this model element and contained elements if they exist."""
for slot in self.__slots__:
attr = getattr(self, slot)
if slot[0] == '_': # convert protected attribute name to public
slot = slot[1:]
if slot not in... | [
"def",
"copy",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"slot",
"in",
"self",
".",
"__slots__",
":",
"attr",
"=",
"getattr",
"(",
"self",
",",
"slot",
")",
"if",
"slot",
"[",
"0",
"]",
"==",
"'_'",
":",
"# conver... | Copy this model element and contained elements if they exist. | [
"Copy",
"this",
"model",
"element",
"and",
"contained",
"elements",
"if",
"they",
"exist",
"."
] | train | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L48-L60 |
b3j0f/conf | b3j0f/conf/model/base.py | ModelElement.update | def update(self, other, copy=True, *args, **kwargs):
"""Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this"""... | python | def update(self, other, copy=True, *args, **kwargs):
"""Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this"""... | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"copy",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"other",
":",
"# dirty hack for python2.6",
"if",
"isinstance",
"(",
"other",
",",
"self",
".",
"__class__",
")",
":",
"i... | Update this element related to other element.
:param other: same type than this.
:param bool copy: copy other before update attributes.
:param tuple args: copy args.
:param dict kwargs: copy kwargs.
:return: this | [
"Update",
"this",
"element",
"related",
"to",
"other",
"element",
"."
] | train | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L108-L134 |
b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.__i | def __i(self, other, func):
"""Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s)."""
if isinstance(oth... | python | def __i(self, other, func):
"""Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s)."""
if isinstance(oth... | [
"def",
"__i",
"(",
"self",
",",
"other",
",",
"func",
")",
":",
"if",
"isinstance",
"(",
"other",
",",
"type",
"(",
"self",
")",
")",
":",
"other",
"=",
"tuple",
"(",
"other",
")",
"elif",
"isinstance",
"(",
"other",
",",
"self",
".",
"__contenttyp... | Process input other with input func.
:param ModelElement(s) other: other ModelElement(s) to process.
:param func: function to apply on a ModelElement.
:return: self.
:raise: TypeError if other is not a ModelElement(s). | [
"Process",
"input",
"other",
"with",
"input",
"func",
"."
] | train | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L179-L200 |
b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.update | def update(self, other, copy=True, *args, **kwargs):
"""Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: se... | python | def update(self, other, copy=True, *args, **kwargs):
"""Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: se... | [
"def",
"update",
"(",
"self",
",",
"other",
",",
"copy",
"=",
"True",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"CompositeModelElement",
",",
"self",
")",
".",
"update",
"(",
"other",
",",
"copy",
"=",
"copy",
",",
"*",
"... | Update this composite model element with other element content.
:param other: element to update with this. Must be the same type of this
or this __contenttype__.
:param bool copy: copy other before updating.
:return: self | [
"Update",
"this",
"composite",
"model",
"element",
"with",
"other",
"element",
"content",
"."
] | train | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L253-L292 |
b3j0f/conf | b3j0f/conf/model/base.py | CompositeModelElement.params | def params(self):
"""Get set of parameters by names.
:rtype: dict"""
result = {}
for content in list(self.values()):
if isinstance(content, CompositeModelElement):
cparams = content.params
for cpname in cparams:
cparam ... | python | def params(self):
"""Get set of parameters by names.
:rtype: dict"""
result = {}
for content in list(self.values()):
if isinstance(content, CompositeModelElement):
cparams = content.params
for cpname in cparams:
cparam ... | [
"def",
"params",
"(",
"self",
")",
":",
"result",
"=",
"{",
"}",
"for",
"content",
"in",
"list",
"(",
"self",
".",
"values",
"(",
")",
")",
":",
"if",
"isinstance",
"(",
"content",
",",
"CompositeModelElement",
")",
":",
"cparams",
"=",
"content",
".... | Get set of parameters by names.
:rtype: dict | [
"Get",
"set",
"of",
"parameters",
"by",
"names",
"."
] | train | https://github.com/b3j0f/conf/blob/18dd6d5d6560f9b202793739e2330a2181163511/b3j0f/conf/model/base.py#L295-L322 |
anti1869/sunhead | src/sunhead/decorators.py | cached_property | def cached_property():
"""
Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name... | python | def cached_property():
"""
Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name... | [
"def",
"cached_property",
"(",
")",
":",
"def",
"_stored_value",
"(",
"f",
")",
":",
"storage_var_name",
"=",
"\"__{}\"",
".",
"format",
"(",
"f",
".",
"__name__",
")",
"def",
"_wrapper",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"... | Handy utility to build caching properties in your classes.
Decorated code will be run only once and then result will be stored in private class property
with the given name. When called for the second time, property will return cached value.
:param storage_var_name: Name of the class property to store cac... | [
"Handy",
"utility",
"to",
"build",
"caching",
"properties",
"in",
"your",
"classes",
".",
"Decorated",
"code",
"will",
"be",
"run",
"only",
"once",
"and",
"then",
"result",
"will",
"be",
"stored",
"in",
"private",
"class",
"property",
"with",
"the",
"given",... | train | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/decorators.py#L18-L40 |
anti1869/sunhead | src/sunhead/decorators.py | deprecated | def deprecated(message=DEPRECATION_MESSAGE, logger=None):
"""
This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function.
"""
if logger is None:
logger = default_logger
def _d... | python | def deprecated(message=DEPRECATION_MESSAGE, logger=None):
"""
This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function.
"""
if logger is None:
logger = default_logger
def _d... | [
"def",
"deprecated",
"(",
"message",
"=",
"DEPRECATION_MESSAGE",
",",
"logger",
"=",
"None",
")",
":",
"if",
"logger",
"is",
"None",
":",
"logger",
"=",
"default_logger",
"def",
"_deprecated",
"(",
"f",
")",
":",
"def",
"_wrapper",
"(",
"*",
"args",
",",... | This decorator will simply print warning before running decoratee.
So, presumably, you want to use it with console-based commands.
:return: Decorator for the function. | [
"This",
"decorator",
"will",
"simply",
"print",
"warning",
"before",
"running",
"decoratee",
".",
"So",
"presumably",
"you",
"want",
"to",
"use",
"it",
"with",
"console",
"-",
"based",
"commands",
"."
] | train | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/decorators.py#L43-L59 |
zaturox/glin | glin/animations.py | AbstractAnimation.prepare | def prepare(self, led_count, target_fps):
"""setup animation"""
self.led_count = led_count
self.target_fps = target_fps | python | def prepare(self, led_count, target_fps):
"""setup animation"""
self.led_count = led_count
self.target_fps = target_fps | [
"def",
"prepare",
"(",
"self",
",",
"led_count",
",",
"target_fps",
")",
":",
"self",
".",
"led_count",
"=",
"led_count",
"self",
".",
"target_fps",
"=",
"target_fps"
] | setup animation | [
"setup",
"animation"
] | train | https://github.com/zaturox/glin/blob/55214a579c4e4b4d74765f3f6aa2eb815bac1c3b/glin/animations.py#L19-L22 |
pjuren/pyokit | src/pyokit/scripts/overlapProfile.py | process_anchor_start | def process_anchor_start(regions_fn, to_count_fn,
anchor_to=ANCHOR_START, normalize=False,
verbose=False):
"""
:return: list where each element is the number of hits at that location
relative to the start of the regions.
"""
res = []
possible = []
... | python | def process_anchor_start(regions_fn, to_count_fn,
anchor_to=ANCHOR_START, normalize=False,
verbose=False):
"""
:return: list where each element is the number of hits at that location
relative to the start of the regions.
"""
res = []
possible = []
... | [
"def",
"process_anchor_start",
"(",
"regions_fn",
",",
"to_count_fn",
",",
"anchor_to",
"=",
"ANCHOR_START",
",",
"normalize",
"=",
"False",
",",
"verbose",
"=",
"False",
")",
":",
"res",
"=",
"[",
"]",
"possible",
"=",
"[",
"]",
"trees",
"=",
"intervalTre... | :return: list where each element is the number of hits at that location
relative to the start of the regions. | [
":",
"return",
":",
"list",
"where",
"each",
"element",
"is",
"the",
"number",
"of",
"hits",
"at",
"that",
"location",
"relative",
"to",
"the",
"start",
"of",
"the",
"regions",
"."
] | train | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/overlapProfile.py#L88-L121 |
pjuren/pyokit | src/pyokit/scripts/overlapProfile.py | _main | def _main(args, prog_name):
"""Process the command line arguments of this script and dispatch."""
# get options and arguments
ui = getUI(prog_name, args)
if ui.optionIsSet("test"):
# just run unit tests
unittest.main(argv=[sys.argv[0]])
elif ui.optionIsSet("help"):
# just show help
ui.usage()... | python | def _main(args, prog_name):
"""Process the command line arguments of this script and dispatch."""
# get options and arguments
ui = getUI(prog_name, args)
if ui.optionIsSet("test"):
# just run unit tests
unittest.main(argv=[sys.argv[0]])
elif ui.optionIsSet("help"):
# just show help
ui.usage()... | [
"def",
"_main",
"(",
"args",
",",
"prog_name",
")",
":",
"# get options and arguments",
"ui",
"=",
"getUI",
"(",
"prog_name",
",",
"args",
")",
"if",
"ui",
".",
"optionIsSet",
"(",
"\"test\"",
")",
":",
"# just run unit tests",
"unittest",
".",
"main",
"(",
... | Process the command line arguments of this script and dispatch. | [
"Process",
"the",
"command",
"line",
"arguments",
"of",
"this",
"script",
"and",
"dispatch",
"."
] | train | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/scripts/overlapProfile.py#L173-L208 |
AndreLouisCaron/runwith | features/steps/cli.py | write_fixture_file | def write_fixture_file(context, path):
"""Write fixture to disk."""
print('CWD:', os.getcwd())
print('FIXTURE:', path)
with open(path, 'w') as stream:
stream.write(context.text) | python | def write_fixture_file(context, path):
"""Write fixture to disk."""
print('CWD:', os.getcwd())
print('FIXTURE:', path)
with open(path, 'w') as stream:
stream.write(context.text) | [
"def",
"write_fixture_file",
"(",
"context",
",",
"path",
")",
":",
"print",
"(",
"'CWD:'",
",",
"os",
".",
"getcwd",
"(",
")",
")",
"print",
"(",
"'FIXTURE:'",
",",
"path",
")",
"with",
"open",
"(",
"path",
",",
"'w'",
")",
"as",
"stream",
":",
"s... | Write fixture to disk. | [
"Write",
"fixture",
"to",
"disk",
"."
] | train | https://github.com/AndreLouisCaron/runwith/blob/cfa2b6ae67d73ec5b24f1502a37060d838276e8b/features/steps/cli.py#L140-L146 |
uw-it-aca/uw-restclients-bookstore | uw_bookstore/__init__.py | Bookstore.get_url_for_schedule | def get_url_for_schedule(self, schedule):
"""
Returns a link to verba. The link varies by campus and schedule.
Multiple calls to this with the same schedule may result in
different urls.
"""
url = self._get_url(schedule)
if url is None:
return None
... | python | def get_url_for_schedule(self, schedule):
"""
Returns a link to verba. The link varies by campus and schedule.
Multiple calls to this with the same schedule may result in
different urls.
"""
url = self._get_url(schedule)
if url is None:
return None
... | [
"def",
"get_url_for_schedule",
"(",
"self",
",",
"schedule",
")",
":",
"url",
"=",
"self",
".",
"_get_url",
"(",
"schedule",
")",
"if",
"url",
"is",
"None",
":",
"return",
"None",
"response",
"=",
"DAO",
".",
"getURL",
"(",
"url",
",",
"{",
"\"Accept\"... | Returns a link to verba. The link varies by campus and schedule.
Multiple calls to this with the same schedule may result in
different urls. | [
"Returns",
"a",
"link",
"to",
"verba",
".",
"The",
"link",
"varies",
"by",
"campus",
"and",
"schedule",
".",
"Multiple",
"calls",
"to",
"this",
"with",
"the",
"same",
"schedule",
"may",
"result",
"in",
"different",
"urls",
"."
] | train | https://github.com/uw-it-aca/uw-restclients-bookstore/blob/c9b187505ad0af0ee8ce3b163a13613a52701f54/uw_bookstore/__init__.py#L76-L92 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | query_yes_no | def query_yes_no(question, default="yes"):
"""Just prompt the user for a yes/no question"""
res = _query_yes_no(question, default)
if res == "yes":
return True
else:
return False | python | def query_yes_no(question, default="yes"):
"""Just prompt the user for a yes/no question"""
res = _query_yes_no(question, default)
if res == "yes":
return True
else:
return False | [
"def",
"query_yes_no",
"(",
"question",
",",
"default",
"=",
"\"yes\"",
")",
":",
"res",
"=",
"_query_yes_no",
"(",
"question",
",",
"default",
")",
"if",
"res",
"==",
"\"yes\"",
":",
"return",
"True",
"else",
":",
"return",
"False"
] | Just prompt the user for a yes/no question | [
"Just",
"prompt",
"the",
"user",
"for",
"a",
"yes",
"/",
"no",
"question"
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L1324-L1330 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _query_yes_no | def _query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer... | python | def _query_yes_no(question, default="yes"):
"""Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer... | [
"def",
"_query_yes_no",
"(",
"question",
",",
"default",
"=",
"\"yes\"",
")",
":",
"valid",
"=",
"{",
"\"yes\"",
":",
"\"yes\"",
",",
"\"y\"",
":",
"\"yes\"",
",",
"\"ye\"",
":",
"\"yes\"",
",",
"\"no\"",
":",
"\"no\"",
",",
"\"n\"",
":",
"\"no\"",
"}"... | Ask a yes/no question via raw_input() and return their answer.
"question" is a string that is presented to the user.
"default" is the presumed answer if the user just hits <Enter>.
It must be "yes" (the default), "no" or None (meaning
an answer is required of the user).
The "answer" return... | [
"Ask",
"a",
"yes",
"/",
"no",
"question",
"via",
"raw_input",
"()",
"and",
"return",
"their",
"answer",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L1334-L1368 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.add_section | def add_section(self, section):
"""Add a new Section object to the config. Should be a subclass of
_AbstractSection."""
if not issubclass(section.__class__, _AbstractSection):
raise TypeError("argument should be a subclass of Section")
self.sections[section.get_key_name()] = ... | python | def add_section(self, section):
"""Add a new Section object to the config. Should be a subclass of
_AbstractSection."""
if not issubclass(section.__class__, _AbstractSection):
raise TypeError("argument should be a subclass of Section")
self.sections[section.get_key_name()] = ... | [
"def",
"add_section",
"(",
"self",
",",
"section",
")",
":",
"if",
"not",
"issubclass",
"(",
"section",
".",
"__class__",
",",
"_AbstractSection",
")",
":",
"raise",
"TypeError",
"(",
"\"argument should be a subclass of Section\"",
")",
"self",
".",
"sections",
... | Add a new Section object to the config. Should be a subclass of
_AbstractSection. | [
"Add",
"a",
"new",
"Section",
"object",
"to",
"the",
"config",
".",
"Should",
"be",
"a",
"subclass",
"of",
"_AbstractSection",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L160-L166 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Config._load | def _load(self, exit_on_failure):
"""One you have added all your configuration data (Section, Element,
...) you need to load data from the config file."""
# pylint: disable-msg=W0621
log = logging.getLogger('argtoolbox')
discoveredFileList = []
if self.config_file:
... | python | def _load(self, exit_on_failure):
"""One you have added all your configuration data (Section, Element,
...) you need to load data from the config file."""
# pylint: disable-msg=W0621
log = logging.getLogger('argtoolbox')
discoveredFileList = []
if self.config_file:
... | [
"def",
"_load",
"(",
"self",
",",
"exit_on_failure",
")",
":",
"# pylint: disable-msg=W0621",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'argtoolbox'",
")",
"discoveredFileList",
"=",
"[",
"]",
"if",
"self",
".",
"config_file",
":",
"if",
"isinstance",
"("... | One you have added all your configuration data (Section, Element,
...) you need to load data from the config file. | [
"One",
"you",
"have",
"added",
"all",
"your",
"configuration",
"data",
"(",
"Section",
"Element",
"...",
")",
"you",
"need",
"to",
"load",
"data",
"from",
"the",
"config",
"file",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L183-L226 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.get_parser | def get_parser(self, **kwargs):
"""This method will create and return a new parser with prog_name,
description, and a config file argument.
"""
self.parser = argparse.ArgumentParser(prog=self.prog_name,
description=self._desc,
... | python | def get_parser(self, **kwargs):
"""This method will create and return a new parser with prog_name,
description, and a config file argument.
"""
self.parser = argparse.ArgumentParser(prog=self.prog_name,
description=self._desc,
... | [
"def",
"get_parser",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"parser",
"=",
"argparse",
".",
"ArgumentParser",
"(",
"prog",
"=",
"self",
".",
"prog_name",
",",
"description",
"=",
"self",
".",
"_desc",
",",
"add_help",
"=",
"False"... | This method will create and return a new parser with prog_name,
description, and a config file argument. | [
"This",
"method",
"will",
"create",
"and",
"return",
"a",
"new",
"parser",
"with",
"prog_name",
"description",
"and",
"a",
"config",
"file",
"argument",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L228-L242 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.reload | def reload(self, hooks=None):
"""This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file ... | python | def reload(self, hooks=None):
"""This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file ... | [
"def",
"reload",
"(",
"self",
",",
"hooks",
"=",
"None",
")",
":",
"#from argcomplete import debug",
"# Parsing the command line looking for the previous options like",
"# configuration file name or server section. Extra arguments",
"# will be store into argv.",
"args",
"=",
"None",
... | This method will reload the configuration using input argument
from the command line interface.
1. pasing arguments
2. applying hooks
3. addding help argument
4. reloading configuration using cli argument like a configuration
file name. | [
"This",
"method",
"will",
"reload",
"the",
"configuration",
"using",
"input",
"argument",
"from",
"the",
"command",
"line",
"interface",
".",
"1",
".",
"pasing",
"arguments",
"2",
".",
"applying",
"hooks",
"3",
".",
"addding",
"help",
"argument",
"4",
".",
... | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L244-L295 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Config.write_default_config_file | def write_default_config_file(self, output, comments=True):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if self.use_config_file:
# pylint: disable-msg=W0621
... | python | def write_default_config_file(self, output, comments=True):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if self.use_config_file:
# pylint: disable-msg=W0621
... | [
"def",
"write_default_config_file",
"(",
"self",
",",
"output",
",",
"comments",
"=",
"True",
")",
":",
"if",
"self",
".",
"use_config_file",
":",
"# pylint: disable-msg=W0621",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'argtoolbox'",
")",
"with",
"open",
... | This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties. | [
"This",
"method",
"write",
"a",
"sample",
"file",
"with",
"attributes",
"descriptions",
"sample",
"values",
"required",
"flags",
"using",
"the",
"configuration",
"object",
"properties",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L314-L336 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _AbstractSection.get_section_name | def get_section_name(self):
"""This method build the current section name that the program will
looking for into the configuration file.
The format is [<prefix>-]<name>[-<suffix>].
"""
a = []
if self._prefix:
a.append(self._prefix)
a.append(str(self._n... | python | def get_section_name(self):
"""This method build the current section name that the program will
looking for into the configuration file.
The format is [<prefix>-]<name>[-<suffix>].
"""
a = []
if self._prefix:
a.append(self._prefix)
a.append(str(self._n... | [
"def",
"get_section_name",
"(",
"self",
")",
":",
"a",
"=",
"[",
"]",
"if",
"self",
".",
"_prefix",
":",
"a",
".",
"append",
"(",
"self",
".",
"_prefix",
")",
"a",
".",
"append",
"(",
"str",
"(",
"self",
".",
"_name",
")",
")",
"if",
"self",
".... | This method build the current section name that the program will
looking for into the configuration file.
The format is [<prefix>-]<name>[-<suffix>]. | [
"This",
"method",
"build",
"the",
"current",
"section",
"name",
"that",
"the",
"program",
"will",
"looking",
"for",
"into",
"the",
"configuration",
"file",
".",
"The",
"format",
"is",
"[",
"<prefix",
">",
"-",
"]",
"<name",
">",
"[",
"-",
"<suffix",
">",... | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L358-L369 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _AbstractSection.get_representation | def get_representation(self, prefix="", suffix="\n"):
"""return the string representation of the current object."""
res = prefix + "Section " + self.get_section_name().upper() + suffix
return res | python | def get_representation(self, prefix="", suffix="\n"):
"""return the string representation of the current object."""
res = prefix + "Section " + self.get_section_name().upper() + suffix
return res | [
"def",
"get_representation",
"(",
"self",
",",
"prefix",
"=",
"\"\"",
",",
"suffix",
"=",
"\"\\n\"",
")",
":",
"res",
"=",
"prefix",
"+",
"\"Section \"",
"+",
"self",
".",
"get_section_name",
"(",
")",
".",
"upper",
"(",
")",
"+",
"suffix",
"return",
"... | return the string representation of the current object. | [
"return",
"the",
"string",
"representation",
"of",
"the",
"current",
"object",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L379-L382 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _AbstractSection.write_config_file | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if comments:
f.write("#####################################\n")
f.wri... | python | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if comments:
f.write("#####################################\n")
f.wri... | [
"def",
"write_config_file",
"(",
"self",
",",
"f",
",",
"comments",
")",
":",
"if",
"comments",
":",
"f",
".",
"write",
"(",
"\"#####################################\\n\"",
")",
"f",
".",
"write",
"(",
"\"# Section : \"",
")",
"f",
".",
"write",
"(",
"\"#\""... | This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties. | [
"This",
"method",
"write",
"a",
"sample",
"file",
"with",
"attributes",
"descriptions",
"sample",
"values",
"required",
"flags",
"using",
"the",
"configuration",
"object",
"properties",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L387-L404 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _Section.add_element | def add_element(self, elt):
"""Helper to add a element to the current section. The Element name
will be used as an identifier."""
if not isinstance(elt, Element):
raise TypeError("argument should be a subclass of Element")
self.elements[elt.get_name()] = elt
return el... | python | def add_element(self, elt):
"""Helper to add a element to the current section. The Element name
will be used as an identifier."""
if not isinstance(elt, Element):
raise TypeError("argument should be a subclass of Element")
self.elements[elt.get_name()] = elt
return el... | [
"def",
"add_element",
"(",
"self",
",",
"elt",
")",
":",
"if",
"not",
"isinstance",
"(",
"elt",
",",
"Element",
")",
":",
"raise",
"TypeError",
"(",
"\"argument should be a subclass of Element\"",
")",
"self",
".",
"elements",
"[",
"elt",
".",
"get_name",
"(... | Helper to add a element to the current section. The Element name
will be used as an identifier. | [
"Helper",
"to",
"add",
"a",
"element",
"to",
"the",
"current",
"section",
".",
"The",
"Element",
"name",
"will",
"be",
"used",
"as",
"an",
"identifier",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L414-L420 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _Section.add_element_list | def add_element_list(self, elt_list, **kwargs):
"""Helper to add a list of similar elements to the current section.
Element names will be used as an identifier."""
for e in elt_list:
self.add_element(Element(e, **kwargs)) | python | def add_element_list(self, elt_list, **kwargs):
"""Helper to add a list of similar elements to the current section.
Element names will be used as an identifier."""
for e in elt_list:
self.add_element(Element(e, **kwargs)) | [
"def",
"add_element_list",
"(",
"self",
",",
"elt_list",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"e",
"in",
"elt_list",
":",
"self",
".",
"add_element",
"(",
"Element",
"(",
"e",
",",
"*",
"*",
"kwargs",
")",
")"
] | Helper to add a list of similar elements to the current section.
Element names will be used as an identifier. | [
"Helper",
"to",
"add",
"a",
"list",
"of",
"similar",
"elements",
"to",
"the",
"current",
"section",
".",
"Element",
"names",
"will",
"be",
"used",
"as",
"an",
"identifier",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L422-L426 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | _Section.write_config_file | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if len(self.elements) < 1:
return
super(_Section, self).write_config_file... | python | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if len(self.elements) < 1:
return
super(_Section, self).write_config_file... | [
"def",
"write_config_file",
"(",
"self",
",",
"f",
",",
"comments",
")",
":",
"if",
"len",
"(",
"self",
".",
"elements",
")",
"<",
"1",
":",
"return",
"super",
"(",
"_Section",
",",
"self",
")",
".",
"write_config_file",
"(",
"f",
",",
"comments",
")... | This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties. | [
"This",
"method",
"write",
"a",
"sample",
"file",
"with",
"attributes",
"descriptions",
"sample",
"values",
"required",
"flags",
"using",
"the",
"configuration",
"object",
"properties",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L462-L473 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.get_representation | def get_representation(self, prefix="", suffix="\n"):
"""This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed.
"""
res = []
if self.hidden:
res.append(prefix + " - " + str(self.... | python | def get_representation(self, prefix="", suffix="\n"):
"""This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed.
"""
res = []
if self.hidden:
res.append(prefix + " - " + str(self.... | [
"def",
"get_representation",
"(",
"self",
",",
"prefix",
"=",
"\"\"",
",",
"suffix",
"=",
"\"\\n\"",
")",
":",
"res",
"=",
"[",
"]",
"if",
"self",
".",
"hidden",
":",
"res",
".",
"append",
"(",
"prefix",
"+",
"\" - \"",
"+",
"str",
"(",
"self",
"."... | This method build a array that will contain the string
representation of the current object. Every lines could be
prefixed and suffixed. | [
"This",
"method",
"build",
"a",
"array",
"that",
"will",
"contain",
"the",
"string",
"representation",
"of",
"the",
"current",
"object",
".",
"Every",
"lines",
"could",
"be",
"prefixed",
"and",
"suffixed",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L658-L679 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.load | def load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied.
"""
self._load(file_parser, section_name)
self.post_load() | python | def load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied.
"""
self._load(file_parser, section_name)
self.post_load() | [
"def",
"load",
"(",
"self",
",",
"file_parser",
",",
"section_name",
")",
":",
"self",
".",
"_load",
"(",
"file_parser",
",",
"section_name",
")",
"self",
".",
"post_load",
"(",
")"
] | The current element is loaded from the configuration file,
all constraints and requirements are checked.
Then element hooks are applied. | [
"The",
"current",
"element",
"is",
"loaded",
"from",
"the",
"configuration",
"file",
"all",
"constraints",
"and",
"requirements",
"are",
"checked",
".",
"Then",
"element",
"hooks",
"are",
"applied",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L697-L703 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Element._load | def _load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
"""
# pylint: disable-msg=W0621
log = logging.getLogger('argtoolbox')
try:
log.debug("looking for field (sec... | python | def _load(self, file_parser, section_name):
"""The current element is loaded from the configuration file,
all constraints and requirements are checked.
"""
# pylint: disable-msg=W0621
log = logging.getLogger('argtoolbox')
try:
log.debug("looking for field (sec... | [
"def",
"_load",
"(",
"self",
",",
"file_parser",
",",
"section_name",
")",
":",
"# pylint: disable-msg=W0621",
"log",
"=",
"logging",
".",
"getLogger",
"(",
"'argtoolbox'",
")",
"try",
":",
"log",
".",
"debug",
"(",
"\"looking for field (section=\"",
"+",
"secti... | The current element is loaded from the configuration file,
all constraints and requirements are checked. | [
"The",
"current",
"element",
"is",
"loaded",
"from",
"the",
"configuration",
"file",
"all",
"constraints",
"and",
"requirements",
"are",
"checked",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L705-L784 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.get_arg_parse_arguments | def get_arg_parse_arguments(self):
"""
During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You... | python | def get_arg_parse_arguments(self):
"""
During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You... | [
"def",
"get_arg_parse_arguments",
"(",
"self",
")",
":",
"ret",
"=",
"dict",
"(",
")",
"if",
"self",
".",
"_required",
":",
"if",
"self",
".",
"value",
"is",
"not",
"None",
":",
"ret",
"[",
"\"default\"",
"]",
"=",
"self",
".",
"value",
"else",
":",
... | During the element declaration, all configuration file requirements
and all cli requirements have been described once.
This method will build a dict containing all argparse options.
It can be used to feed argparse.ArgumentParser.
You does not need to have multiple declarations. | [
"During",
"the",
"element",
"declaration",
"all",
"configuration",
"file",
"requirements",
"and",
"all",
"cli",
"requirements",
"have",
"been",
"described",
"once",
".",
"This",
"method",
"will",
"build",
"a",
"dict",
"containing",
"all",
"argparse",
"options",
... | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L789-L813 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | Element.write_config_file | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if self.conf_hidden:
return False
if comments:
f.write("\n")... | python | def write_config_file(self, f, comments):
"""This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties.
"""
if self.conf_hidden:
return False
if comments:
f.write("\n")... | [
"def",
"write_config_file",
"(",
"self",
",",
"f",
",",
"comments",
")",
":",
"if",
"self",
".",
"conf_hidden",
":",
"return",
"False",
"if",
"comments",
":",
"f",
".",
"write",
"(",
"\"\\n\"",
")",
"f",
".",
"write",
"(",
"\"# Attribute (\"",
")",
"f"... | This method write a sample file, with attributes, descriptions,
sample values, required flags, using the configuration object
properties. | [
"This",
"method",
"write",
"a",
"sample",
"file",
"with",
"attributes",
"descriptions",
"sample",
"values",
"required",
"flags",
"using",
"the",
"configuration",
"object",
"properties",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L815-L844 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | ElementWithSubSections.add_section | def add_section(self, section):
"""You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree.
"""
if not issubclass(section.__class__, SubSection):
raise TypeError("Argument should be a subclass of SubSecti... | python | def add_section(self, section):
"""You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree.
"""
if not issubclass(section.__class__, SubSection):
raise TypeError("Argument should be a subclass of SubSecti... | [
"def",
"add_section",
"(",
"self",
",",
"section",
")",
":",
"if",
"not",
"issubclass",
"(",
"section",
".",
"__class__",
",",
"SubSection",
")",
":",
"raise",
"TypeError",
"(",
"\"Argument should be a subclass of SubSection, \\\n not :\"",
"... | You can add section inside a Element, the section must be a
subclass of SubSection. You can use this class to represent a tree. | [
"You",
"can",
"add",
"section",
"inside",
"a",
"Element",
"the",
"section",
"must",
"be",
"a",
"subclass",
"of",
"SubSection",
".",
"You",
"can",
"use",
"this",
"class",
"to",
"represent",
"a",
"tree",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L881-L890 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | BasicProgram.add_config_options | def add_config_options(self):
""" You can override this method in order to add your options to the
config object."""
# default section
default = self.config.get_default_section()
default.add_element(
Element('debug',
e_type=int,
... | python | def add_config_options(self):
""" You can override this method in order to add your options to the
config object."""
# default section
default = self.config.get_default_section()
default.add_element(
Element('debug',
e_type=int,
... | [
"def",
"add_config_options",
"(",
"self",
")",
":",
"# default section",
"default",
"=",
"self",
".",
"config",
".",
"get_default_section",
"(",
")",
"default",
".",
"add_element",
"(",
"Element",
"(",
"'debug'",
",",
"e_type",
"=",
"int",
",",
"e_type_exclude... | You can override this method in order to add your options to the
config object. | [
"You",
"can",
"override",
"this",
"method",
"in",
"order",
"to",
"add",
"your",
"options",
"to",
"the",
"config",
"object",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L1244-L1254 |
fred49/argtoolbox | argtoolbox/argtoolbox.py | BasicProgram.add_commands | def add_commands(self):
""" You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time."""
self.parser.add_argument(
'-d',
action="count",
**self.config.default.deb... | python | def add_commands(self):
""" You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time."""
self.parser.add_argument(
'-d',
action="count",
**self.config.default.deb... | [
"def",
"add_commands",
"(",
"self",
")",
":",
"self",
".",
"parser",
".",
"add_argument",
"(",
"'-d'",
",",
"action",
"=",
"\"count\"",
",",
"*",
"*",
"self",
".",
"config",
".",
"default",
".",
"debug",
".",
"get_arg_parse_arguments",
"(",
")",
")"
] | You can override this method in order to add your command line
arguments to the argparse parser. The configuration file was
reloaded at this time. | [
"You",
"can",
"override",
"this",
"method",
"in",
"order",
"to",
"add",
"your",
"command",
"line",
"arguments",
"to",
"the",
"argparse",
"parser",
".",
"The",
"configuration",
"file",
"was",
"reloaded",
"at",
"this",
"time",
"."
] | train | https://github.com/fred49/argtoolbox/blob/e32ad6265567d5a1891df3c3425423774dafab41/argtoolbox/argtoolbox.py#L1283-L1290 |
tlevine/vlermv | vlermv/_util.py | split | def split(path):
'Split a path into a tuple of all directories and then the final directory/file.'
if path == '':
raise ValueError('Path may not be empty.')
dn, fn = os.path.split(path)
if fn == '':
return (dn,)
elif dn == '':
return (fn,)
else:
return split(dn) ... | python | def split(path):
'Split a path into a tuple of all directories and then the final directory/file.'
if path == '':
raise ValueError('Path may not be empty.')
dn, fn = os.path.split(path)
if fn == '':
return (dn,)
elif dn == '':
return (fn,)
else:
return split(dn) ... | [
"def",
"split",
"(",
"path",
")",
":",
"if",
"path",
"==",
"''",
":",
"raise",
"ValueError",
"(",
"'Path may not be empty.'",
")",
"dn",
",",
"fn",
"=",
"os",
".",
"path",
".",
"split",
"(",
"path",
")",
"if",
"fn",
"==",
"''",
":",
"return",
"(",
... | Split a path into a tuple of all directories and then the final directory/file. | [
"Split",
"a",
"path",
"into",
"a",
"tuple",
"of",
"all",
"directories",
"and",
"then",
"the",
"final",
"directory",
"/",
"file",
"."
] | train | https://github.com/tlevine/vlermv/blob/0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20/vlermv/_util.py#L3-L14 |
tlevine/vlermv | vlermv/_util.py | method_or_name | def method_or_name(namespace, x):
'''
If x is a ``str``, get ``namespace.x``.
Otherwise, simply return ``x``.
'''
if not isinstance(x, str):
return x
if hasattr(namespace, x):
return getattr(namespace, x)
attrs = [y for y in dir(namespace) if not y.startswith('_')]
msg... | python | def method_or_name(namespace, x):
'''
If x is a ``str``, get ``namespace.x``.
Otherwise, simply return ``x``.
'''
if not isinstance(x, str):
return x
if hasattr(namespace, x):
return getattr(namespace, x)
attrs = [y for y in dir(namespace) if not y.startswith('_')]
msg... | [
"def",
"method_or_name",
"(",
"namespace",
",",
"x",
")",
":",
"if",
"not",
"isinstance",
"(",
"x",
",",
"str",
")",
":",
"return",
"x",
"if",
"hasattr",
"(",
"namespace",
",",
"x",
")",
":",
"return",
"getattr",
"(",
"namespace",
",",
"x",
")",
"a... | If x is a ``str``, get ``namespace.x``.
Otherwise, simply return ``x``. | [
"If",
"x",
"is",
"a",
"str",
"get",
"namespace",
".",
"x",
"."
] | train | https://github.com/tlevine/vlermv/blob/0b332ea1c20e4065b30f5e3ec0c1d0fffbce6b20/vlermv/_util.py#L16-L31 |
henrysher/kotocore | kotocore/introspection.py | Introspection.strip_html | def strip_html(self, doc):
"""
This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns:... | python | def strip_html(self, doc):
"""
This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns:... | [
"def",
"strip_html",
"(",
"self",
",",
"doc",
")",
":",
"if",
"not",
"isinstance",
"(",
"doc",
",",
"six",
".",
"string_types",
")",
":",
"return",
"''",
"doc",
"=",
"doc",
".",
"strip",
"(",
")",
"doc",
"=",
"self",
".",
"tag_re",
".",
"sub",
"(... | This method removes all HTML from a docstring.
Lighter than ``convert_docs``, this is intended for the documentation
on **parameters**, not the overall docs themselves.
:param doc: The initial docstring
:type doc: string
:returns: The stripped/cleaned docstring
:rtype:... | [
"This",
"method",
"removes",
"all",
"HTML",
"from",
"a",
"docstring",
"."
] | train | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L84-L102 |
henrysher/kotocore | kotocore/introspection.py | Introspection.parse_param | def parse_param(self, core_param):
"""
Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information
"""
return {
... | python | def parse_param(self, core_param):
"""
Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information
"""
return {
... | [
"def",
"parse_param",
"(",
"self",
",",
"core_param",
")",
":",
"return",
"{",
"'var_name'",
":",
"core_param",
".",
"py_name",
",",
"'api_name'",
":",
"core_param",
".",
"name",
",",
"'required'",
":",
"core_param",
".",
"required",
",",
"'docs'",
":",
"s... | Returns data about a specific parameter.
:param core_param: The ``Parameter`` to introspect
:type core_param: A ``<botocore.parameters.Parameter>`` subclass
:returns: A dict of the relevant information | [
"Returns",
"data",
"about",
"a",
"specific",
"parameter",
"."
] | train | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L104-L119 |
henrysher/kotocore | kotocore/introspection.py | Introspection.parse_params | def parse_params(self, core_params):
"""
Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dicti... | python | def parse_params(self, core_params):
"""
Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dicti... | [
"def",
"parse_params",
"(",
"self",
",",
"core_params",
")",
":",
"params",
"=",
"[",
"]",
"for",
"core_param",
"in",
"core_params",
":",
"params",
".",
"append",
"(",
"self",
".",
"parse_param",
"(",
"core_param",
")",
")",
"return",
"params"
] | Goes through a set of parameters, extracting information about each.
:param core_params: The collection of parameters
:type core_params: A collection of ``<botocore.parameters.Parameter>``
subclasses
:returns: A list of dictionaries | [
"Goes",
"through",
"a",
"set",
"of",
"parameters",
"extracting",
"information",
"about",
"each",
"."
] | train | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L121-L136 |
henrysher/kotocore | kotocore/introspection.py | Introspection.introspect_operation | def introspect_operation(self, operation):
"""
Introspects an entire operation, returning::
* the method name (to expose to the user)
* the API name (used server-side)
* docs
* introspected information about the parameters
* information about the output
... | python | def introspect_operation(self, operation):
"""
Introspects an entire operation, returning::
* the method name (to expose to the user)
* the API name (used server-side)
* docs
* introspected information about the parameters
* information about the output
... | [
"def",
"introspect_operation",
"(",
"self",
",",
"operation",
")",
":",
"return",
"{",
"'method_name'",
":",
"operation",
".",
"py_name",
",",
"'api_name'",
":",
"operation",
".",
"name",
",",
"'docs'",
":",
"self",
".",
"convert_docs",
"(",
"operation",
"."... | Introspects an entire operation, returning::
* the method name (to expose to the user)
* the API name (used server-side)
* docs
* introspected information about the parameters
* information about the output
:param operation: The operation to introspect
:type ope... | [
"Introspects",
"an",
"entire",
"operation",
"returning",
"::"
] | train | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L150-L171 |
henrysher/kotocore | kotocore/introspection.py | Introspection.introspect_service | def introspect_service(self, service_name):
"""
Introspects all the operations (& related information) about a service.
:param service_name: The desired service name
:type service_name: string
:returns: A dict of all operation names & information
"""
data = {}
... | python | def introspect_service(self, service_name):
"""
Introspects all the operations (& related information) about a service.
:param service_name: The desired service name
:type service_name: string
:returns: A dict of all operation names & information
"""
data = {}
... | [
"def",
"introspect_service",
"(",
"self",
",",
"service_name",
")",
":",
"data",
"=",
"{",
"}",
"service",
"=",
"self",
".",
"get_service",
"(",
"service_name",
")",
"for",
"operation",
"in",
"service",
".",
"operations",
":",
"# These are ``Operation`` objects,... | Introspects all the operations (& related information) about a service.
:param service_name: The desired service name
:type service_name: string
:returns: A dict of all operation names & information | [
"Introspects",
"all",
"the",
"operations",
"(",
"&",
"related",
"information",
")",
"about",
"a",
"service",
"."
] | train | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/introspection.py#L173-L190 |
AshleySetter/qplots | qplots/qplots/DynamicZoom.py | get_closest_index | def get_closest_index(myList, myNumber):
"""
Assumes myList is sorted. Returns closest value to myNumber.
If two numbers are equally close, return the smallest number.
Parameters
----------
myList : array
The list in which to find the closest value to myNumber
myNumber : float
... | python | def get_closest_index(myList, myNumber):
"""
Assumes myList is sorted. Returns closest value to myNumber.
If two numbers are equally close, return the smallest number.
Parameters
----------
myList : array
The list in which to find the closest value to myNumber
myNumber : float
... | [
"def",
"get_closest_index",
"(",
"myList",
",",
"myNumber",
")",
":",
"closest_values_index",
"=",
"_np",
".",
"where",
"(",
"self",
".",
"time",
"==",
"take_closest",
"(",
"myList",
",",
"myNumber",
")",
")",
"[",
"0",
"]",
"[",
"0",
"]",
"return",
"c... | Assumes myList is sorted. Returns closest value to myNumber.
If two numbers are equally close, return the smallest number.
Parameters
----------
myList : array
The list in which to find the closest value to myNumber
myNumber : float
The number to find the closest to in MyList
R... | [
"Assumes",
"myList",
"is",
"sorted",
".",
"Returns",
"closest",
"value",
"to",
"myNumber",
".",
"If",
"two",
"numbers",
"are",
"equally",
"close",
"return",
"the",
"smallest",
"number",
"."
] | train | https://github.com/AshleySetter/qplots/blob/780ca98e6c08bee612d2c3db37e27e38be5ddec3/qplots/qplots/DynamicZoom.py#L34-L52 |
Nydareld/ConfigEnv | ConfigEnv/Config.py | Config.addFile | def addFile(self,file):
"""
Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier
"""
mylambda= lambda adict : { k... | python | def addFile(self,file):
"""
Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier
"""
mylambda= lambda adict : { k... | [
"def",
"addFile",
"(",
"self",
",",
"file",
")",
":",
"mylambda",
"=",
"lambda",
"adict",
":",
"{",
"key",
".",
"upper",
"(",
")",
":",
"mylambda",
"(",
"adict",
"[",
"key",
"]",
")",
"if",
"isinstance",
"(",
"adict",
"[",
"key",
"]",
",",
"dict"... | Permet d'ajouter un fichier
Args:
file (string): path d'un fichier json
Returns:
type: None
Raises:
FileFormatException: Erreur du format de fichier | [
"Permet",
"d",
"ajouter",
"un",
"fichier"
] | train | https://github.com/Nydareld/ConfigEnv/blob/38c13e5dd9d6c5f3dcd4c1194507a43384c31e29/ConfigEnv/Config.py#L16-L41 |
Nydareld/ConfigEnv | ConfigEnv/Config.py | Config.get | def get(self,path):
"""
permet de récupérer une config
Args:
path (String): Nom d'une config
Returns:
type: String
la valeur de la config ou None
"""
path = path.upper()
if path in self._configCache:
re... | python | def get(self,path):
"""
permet de récupérer une config
Args:
path (String): Nom d'une config
Returns:
type: String
la valeur de la config ou None
"""
path = path.upper()
if path in self._configCache:
re... | [
"def",
"get",
"(",
"self",
",",
"path",
")",
":",
"path",
"=",
"path",
".",
"upper",
"(",
")",
"if",
"path",
"in",
"self",
".",
"_configCache",
":",
"return",
"self",
".",
"_configCache",
"[",
"path",
"]",
"else",
":",
"return",
"self",
".",
"_find... | permet de récupérer une config
Args:
path (String): Nom d'une config
Returns:
type: String
la valeur de la config ou None | [
"permet",
"de",
"récupérer",
"une",
"config"
] | train | https://github.com/Nydareld/ConfigEnv/blob/38c13e5dd9d6c5f3dcd4c1194507a43384c31e29/ConfigEnv/Config.py#L43-L58 |
AguaClara/aide_document-DEPRECATED | aide_document/combine.py | render_document | def render_document(template_name, data_name, output_name):
"""
Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact ... | python | def render_document(template_name, data_name, output_name):
"""
Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact ... | [
"def",
"render_document",
"(",
"template_name",
",",
"data_name",
",",
"output_name",
")",
":",
"# Set up environment and load templates from pip package",
"env",
"=",
"Environment",
"(",
"loader",
"=",
"PackageLoader",
"(",
"'aide_document'",
")",
")",
"#TODO: add custom... | Combines a MarkDown template file from the aide_document package with a local associated YAML data file, then outputs the rendered combination to a local MarkDown output file.
Parameters
==========
template_name : String
Exact name of the MarkDown template file from the aide_document/templates fold... | [
"Combines",
"a",
"MarkDown",
"template",
"file",
"from",
"the",
"aide_document",
"package",
"with",
"a",
"local",
"associated",
"YAML",
"data",
"file",
"then",
"outputs",
"the",
"rendered",
"combination",
"to",
"a",
"local",
"MarkDown",
"output",
"file",
"."
] | train | https://github.com/AguaClara/aide_document-DEPRECATED/blob/3f3b5c9f321264e0e4d8ed68dfbc080762579815/aide_document/combine.py#L5-L37 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorService.stop | def stop(self):
"""
stop the injector service. By the way stoping all Pykka actors if not cleanly closed.
:return:
"""
LOGGER.debug("InjectorService.stop")
self.driver.stop()
InjectorUITreeService.requester = None
InjectorCachedRegistryFactoryService.reque... | python | def stop(self):
"""
stop the injector service. By the way stoping all Pykka actors if not cleanly closed.
:return:
"""
LOGGER.debug("InjectorService.stop")
self.driver.stop()
InjectorUITreeService.requester = None
InjectorCachedRegistryFactoryService.reque... | [
"def",
"stop",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorService.stop\"",
")",
"self",
".",
"driver",
".",
"stop",
"(",
")",
"InjectorUITreeService",
".",
"requester",
"=",
"None",
"InjectorCachedRegistryFactoryService",
".",
"requester",
"=... | stop the injector service. By the way stoping all Pykka actors if not cleanly closed.
:return: | [
"stop",
"the",
"injector",
"service",
".",
"By",
"the",
"way",
"stoping",
"all",
"Pykka",
"actors",
"if",
"not",
"cleanly",
"closed",
".",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L79-L89 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorUITreeService.find_ui_tree_entity | def find_ui_tree_entity(entity_id=None, entity_value=None, entity_ca=None):
"""
find the Ariane UI tree menu entity depending on its id (priority), value or context address
:param entity_id: the Ariane UI tree menu ID to search
:param entity_value: the Ariane UI tree menu Value to search... | python | def find_ui_tree_entity(entity_id=None, entity_value=None, entity_ca=None):
"""
find the Ariane UI tree menu entity depending on its id (priority), value or context address
:param entity_id: the Ariane UI tree menu ID to search
:param entity_value: the Ariane UI tree menu Value to search... | [
"def",
"find_ui_tree_entity",
"(",
"entity_id",
"=",
"None",
",",
"entity_value",
"=",
"None",
",",
"entity_ca",
"=",
"None",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorUITreeService.find_ui_tree_entity\"",
")",
"operation",
"=",
"None",
"search_criteria",
... | find the Ariane UI tree menu entity depending on its id (priority), value or context address
:param entity_id: the Ariane UI tree menu ID to search
:param entity_value: the Ariane UI tree menu Value to search
:param entity_ca: the Ariane UI tree menu context address to search
:return: | [
"find",
"the",
"Ariane",
"UI",
"tree",
"menu",
"entity",
"depending",
"on",
"its",
"id",
"(",
"priority",
")",
"value",
"or",
"context",
"address",
":",
"param",
"entity_id",
":",
"the",
"Ariane",
"UI",
"tree",
"menu",
"ID",
"to",
"search",
":",
"param",... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L107-L147 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorUITreeEntity.json_2_injector_ui_tree_menu_entity | def json_2_injector_ui_tree_menu_entity(json_obj):
"""
transform remote JSON UI entity to local object
:param json_obj: the retrieved Ariane Menu entity to transform
:return: the local object InjectorUITreeEntity
"""
LOGGER.debug("InjectorUITreeEntity.json_2_injector_ui_t... | python | def json_2_injector_ui_tree_menu_entity(json_obj):
"""
transform remote JSON UI entity to local object
:param json_obj: the retrieved Ariane Menu entity to transform
:return: the local object InjectorUITreeEntity
"""
LOGGER.debug("InjectorUITreeEntity.json_2_injector_ui_t... | [
"def",
"json_2_injector_ui_tree_menu_entity",
"(",
"json_obj",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorUITreeEntity.json_2_injector_ui_tree_menu_entity\"",
")",
"return",
"InjectorUITreeEntity",
"(",
"uitid",
"=",
"json_obj",
"[",
"'id'",
"]",
",",
"value",
"=... | transform remote JSON UI entity to local object
:param json_obj: the retrieved Ariane Menu entity to transform
:return: the local object InjectorUITreeEntity | [
"transform",
"remote",
"JSON",
"UI",
"entity",
"to",
"local",
"object",
":",
"param",
"json_obj",
":",
"the",
"retrieved",
"Ariane",
"Menu",
"entity",
"to",
"transform",
":",
"return",
":",
"the",
"local",
"object",
"InjectorUITreeEntity"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L155-L181 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorUITreeEntity.injector_ui_tree_menu_entity_2_json | def injector_ui_tree_menu_entity_2_json(self, ignore_genealogy=False):
"""
transform this local object to JSON
:param ignore_genealogy: ignore the genealogy of this object if true (awaited format for Ariane server)
:return: the resulting JSON of transformation
"""
LOGGER.... | python | def injector_ui_tree_menu_entity_2_json(self, ignore_genealogy=False):
"""
transform this local object to JSON
:param ignore_genealogy: ignore the genealogy of this object if true (awaited format for Ariane server)
:return: the resulting JSON of transformation
"""
LOGGER.... | [
"def",
"injector_ui_tree_menu_entity_2_json",
"(",
"self",
",",
"ignore_genealogy",
"=",
"False",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorUITreeEntity.injector_ui_tree_menu_entity_2_json\"",
")",
"if",
"ignore_genealogy",
":",
"json_obj",
"=",
"{",
"'id'",
":"... | transform this local object to JSON
:param ignore_genealogy: ignore the genealogy of this object if true (awaited format for Ariane server)
:return: the resulting JSON of transformation | [
"transform",
"this",
"local",
"object",
"to",
"JSON",
":",
"param",
"ignore_genealogy",
":",
"ignore",
"the",
"genealogy",
"of",
"this",
"object",
"if",
"true",
"(",
"awaited",
"format",
"for",
"Ariane",
"server",
")",
":",
"return",
":",
"the",
"resulting",... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L183-L242 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorUITreeEntity.save | def save(self):
"""
save or update this entity on Ariane server
:return:
"""
LOGGER.debug("InjectorUITreeEntity.save")
if self.id and self.value and self.type:
ok = True
if InjectorUITreeService.find_ui_tree_entity(self.id) is None: # SAVE
... | python | def save(self):
"""
save or update this entity on Ariane server
:return:
"""
LOGGER.debug("InjectorUITreeEntity.save")
if self.id and self.value and self.type:
ok = True
if InjectorUITreeService.find_ui_tree_entity(self.id) is None: # SAVE
... | [
"def",
"save",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorUITreeEntity.save\"",
")",
"if",
"self",
".",
"id",
"and",
"self",
".",
"value",
"and",
"self",
".",
"type",
":",
"ok",
"=",
"True",
"if",
"InjectorUITreeService",
".",
"find_u... | save or update this entity on Ariane server
:return: | [
"save",
"or",
"update",
"this",
"entity",
"on",
"Ariane",
"server",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L296-L343 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorUITreeEntity.remove | def remove(self):
"""
remove the entity from the Ariane server
:return:
"""
LOGGER.debug("InjectorUITreeEntity.remove")
if self.id and InjectorUITreeService.find_ui_tree_entity(self.id) is not None:
args = {'properties': {'OPERATION': 'UNREGISTER', 'TREE_MENU_... | python | def remove(self):
"""
remove the entity from the Ariane server
:return:
"""
LOGGER.debug("InjectorUITreeEntity.remove")
if self.id and InjectorUITreeService.find_ui_tree_entity(self.id) is not None:
args = {'properties': {'OPERATION': 'UNREGISTER', 'TREE_MENU_... | [
"def",
"remove",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorUITreeEntity.remove\"",
")",
"if",
"self",
".",
"id",
"and",
"InjectorUITreeService",
".",
"find_ui_tree_entity",
"(",
"self",
".",
"id",
")",
"is",
"not",
"None",
":",
"args",
... | remove the entity from the Ariane server
:return: | [
"remove",
"the",
"entity",
"from",
"the",
"Ariane",
"server",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L345-L364 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedRegistryFactoryService.make_gears_cache_registry | def make_gears_cache_registry(args):
"""
create a new gears registry cache on Ariane Server
:param args: the cache parameters - look to the tests to know more
:return: remote procedure call return - look to the tests to know more
"""
LOGGER.debug("InjectorCachedRegistryFa... | python | def make_gears_cache_registry(args):
"""
create a new gears registry cache on Ariane Server
:param args: the cache parameters - look to the tests to know more
:return: remote procedure call return - look to the tests to know more
"""
LOGGER.debug("InjectorCachedRegistryFa... | [
"def",
"make_gears_cache_registry",
"(",
"args",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedRegistryFactoryService.make_gears_cache_registry\"",
")",
"if",
"args",
"is",
"None",
":",
"err_msg",
"=",
"'InjectorCachedRegistryFactoryService.make_gears_cache_registry -... | create a new gears registry cache on Ariane Server
:param args: the cache parameters - look to the tests to know more
:return: remote procedure call return - look to the tests to know more | [
"create",
"a",
"new",
"gears",
"registry",
"cache",
"on",
"Ariane",
"Server",
":",
"param",
"args",
":",
"the",
"cache",
"parameters",
"-",
"look",
"to",
"the",
"tests",
"to",
"know",
"more",
":",
"return",
":",
"remote",
"procedure",
"call",
"return",
"... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L383-L431 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponentService.find_component | def find_component(co_id):
"""
find a component from the Ariane server cache depending on its id
:param co_id: the component id to find
:return: the component if found and None if not
"""
LOGGER.debug("InjectorCachedComponentService.find_component")
ret = None
... | python | def find_component(co_id):
"""
find a component from the Ariane server cache depending on its id
:param co_id: the component id to find
:return: the component if found and None if not
"""
LOGGER.debug("InjectorCachedComponentService.find_component")
ret = None
... | [
"def",
"find_component",
"(",
"co_id",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponentService.find_component\"",
")",
"ret",
"=",
"None",
"if",
"co_id",
"is",
"not",
"None",
":",
"args",
"=",
"{",
"'properties'",
":",
"{",
"'OPERATION'",
":",... | find a component from the Ariane server cache depending on its id
:param co_id: the component id to find
:return: the component if found and None if not | [
"find",
"a",
"component",
"from",
"the",
"Ariane",
"server",
"cache",
"depending",
"on",
"its",
"id",
":",
"param",
"co_id",
":",
"the",
"component",
"id",
"to",
"find",
":",
"return",
":",
"the",
"component",
"if",
"found",
"and",
"None",
"if",
"not"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L508-L531 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponentService.make_refresh_on_demand_service | def make_refresh_on_demand_service(injector_component):
"""
create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the created service
""... | python | def make_refresh_on_demand_service(injector_component):
"""
create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the created service
""... | [
"def",
"make_refresh_on_demand_service",
"(",
"injector_component",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponentService.make_refresh_on_demand_service\"",
")",
"args",
"=",
"{",
"'service_q'",
":",
"injector_component",
".",
"id",
",",
"'treatment_callb... | create a refresh on demand service listening to refresh order on the component admin queue
:param injector_component: the injector_component to bind with the new refresh on demande service
:return: the created service | [
"create",
"a",
"refresh",
"on",
"demand",
"service",
"listening",
"to",
"refresh",
"order",
"on",
"the",
"component",
"admin",
"queue",
":",
"param",
"injector_component",
":",
"the",
"injector_component",
"to",
"bind",
"with",
"the",
"new",
"refresh",
"on",
"... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L555-L567 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponent.json_2_injector_component | def json_2_injector_component(json_obj):
"""
transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedComponent
"""
LOGGER.debug("InjectorCachedComponent.json_2_injector_component")
... | python | def json_2_injector_component(json_obj):
"""
transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedComponent
"""
LOGGER.debug("InjectorCachedComponent.json_2_injector_component")
... | [
"def",
"json_2_injector_component",
"(",
"json_obj",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponent.json_2_injector_component\"",
")",
"return",
"InjectorCachedComponent",
"(",
"component_id",
"=",
"json_obj",
"[",
"'componentId'",
"]",
",",
"component_... | transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedComponent | [
"transform",
"the",
"JSON",
"return",
"by",
"Ariane",
"server",
"to",
"local",
"object",
":",
"param",
"json_obj",
":",
"the",
"JSON",
"returned",
"by",
"Ariane",
"server",
":",
"return",
":",
"a",
"new",
"InjectorCachedComponent"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L577-L593 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponent.injector_component_2_json | def injector_component_2_json(self, properties_only=False):
"""
transform this local object to JSON. If properties only ignore the component blob (awaited by Ariane Server)
:param properties_only: true or false
:return: the JSON from this local object
"""
LOGGER.debug("In... | python | def injector_component_2_json(self, properties_only=False):
"""
transform this local object to JSON. If properties only ignore the component blob (awaited by Ariane Server)
:param properties_only: true or false
:return: the JSON from this local object
"""
LOGGER.debug("In... | [
"def",
"injector_component_2_json",
"(",
"self",
",",
"properties_only",
"=",
"False",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponent.injector_component_2_json\"",
")",
"if",
"properties_only",
":",
"json_obj",
"=",
"{",
"'componentId'",
":",
"self"... | transform this local object to JSON. If properties only ignore the component blob (awaited by Ariane Server)
:param properties_only: true or false
:return: the JSON from this local object | [
"transform",
"this",
"local",
"object",
"to",
"JSON",
".",
"If",
"properties",
"only",
"ignore",
"the",
"component",
"blob",
"(",
"awaited",
"by",
"Ariane",
"Server",
")",
":",
"param",
"properties_only",
":",
"true",
"or",
"false",
":",
"return",
":",
"th... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L595-L625 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponent.save | def save(self, refreshing=None, next_action=None, json_last_refresh=None, data_blob=None):
"""
save or update the component on the Ariane server cache
:param refreshing: the new refreshing value - default None and ignored
:param next_action: the new next action - default None and ignored... | python | def save(self, refreshing=None, next_action=None, json_last_refresh=None, data_blob=None):
"""
save or update the component on the Ariane server cache
:param refreshing: the new refreshing value - default None and ignored
:param next_action: the new next action - default None and ignored... | [
"def",
"save",
"(",
"self",
",",
"refreshing",
"=",
"None",
",",
"next_action",
"=",
"None",
",",
"json_last_refresh",
"=",
"None",
",",
"data_blob",
"=",
"None",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponent.save\"",
")",
"ret",
"=",
"... | save or update the component on the Ariane server cache
:param refreshing: the new refreshing value - default None and ignored
:param next_action: the new next action - default None and ignored
:param json_last_refresh: the new json last refresh - default the date of this call
:param dat... | [
"save",
"or",
"update",
"the",
"component",
"on",
"the",
"Ariane",
"server",
"cache",
":",
"param",
"refreshing",
":",
"the",
"new",
"refreshing",
"value",
"-",
"default",
"None",
"and",
"ignored",
":",
"param",
"next_action",
":",
"the",
"new",
"next",
"a... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L661-L704 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponent.remove | def remove(self):
"""
remove this component from Ariane server cache, stop the on demand refresh and actor linked to this component
:return:
"""
LOGGER.debug("InjectorCachedComponent.remove")
ret = True
args = {'properties': {'OPERATION': 'DEL_COMPONENT_FROM_CACHE... | python | def remove(self):
"""
remove this component from Ariane server cache, stop the on demand refresh and actor linked to this component
:return:
"""
LOGGER.debug("InjectorCachedComponent.remove")
ret = True
args = {'properties': {'OPERATION': 'DEL_COMPONENT_FROM_CACHE... | [
"def",
"remove",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponent.remove\"",
")",
"ret",
"=",
"True",
"args",
"=",
"{",
"'properties'",
":",
"{",
"'OPERATION'",
":",
"'DEL_COMPONENT_FROM_CACHE'",
",",
"'REMOTE_COMPONENT'",
":",
"str... | remove this component from Ariane server cache, stop the on demand refresh and actor linked to this component
:return: | [
"remove",
"this",
"component",
"from",
"Ariane",
"server",
"cache",
"stop",
"the",
"on",
"demand",
"refresh",
"and",
"actor",
"linked",
"to",
"this",
"component",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L706-L732 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedComponent.refresh | def refresh(self, props, body):
"""
the refresh method called when on demand refresh service receive a message. then call the parent actor sniff
method if message is compliant on what is attended
:param props: the message properties
:param body: the message body
:return:
... | python | def refresh(self, props, body):
"""
the refresh method called when on demand refresh service receive a message. then call the parent actor sniff
method if message is compliant on what is attended
:param props: the message properties
:param body: the message body
:return:
... | [
"def",
"refresh",
"(",
"self",
",",
"props",
",",
"body",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedComponent.refresh\"",
")",
"operation",
"=",
"props",
"[",
"'OPERATION'",
"]",
"if",
"operation",
"==",
"\"REFRESH\"",
":",
"if",
"self",
".",
... | the refresh method called when on demand refresh service receive a message. then call the parent actor sniff
method if message is compliant on what is attended
:param props: the message properties
:param body: the message body
:return: | [
"the",
"refresh",
"method",
"called",
"when",
"on",
"demand",
"refresh",
"service",
"receive",
"a",
"message",
".",
"then",
"call",
"the",
"parent",
"actor",
"sniff",
"method",
"if",
"message",
"is",
"compliant",
"on",
"what",
"is",
"attended",
":",
"param",... | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L734-L749 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorComponentSkeleton.cache | def cache(self, refreshing=None, next_action=None, data_blob=None, json_last_refresh=None, rollback_point=False):
"""
push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob ... | python | def cache(self, refreshing=None, next_action=None, data_blob=None, json_last_refresh=None, rollback_point=False):
"""
push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob ... | [
"def",
"cache",
"(",
"self",
",",
"refreshing",
"=",
"None",
",",
"next_action",
"=",
"None",
",",
"data_blob",
"=",
"None",
",",
"json_last_refresh",
"=",
"None",
",",
"rollback_point",
"=",
"False",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCompo... | push this component into the cache
:param refreshing: the new refreshing value
:param next_action: the new next action value
:param data_blob: the new data blob value
:param json_last_refresh: the new json last refresh value - if None the date of this call
:param rollback_point:... | [
"push",
"this",
"component",
"into",
"the",
"cache"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L808-L829 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorComponentSkeleton.rollback | def rollback(self):
"""
push back last rollbackpoint into the cache
:return:
"""
return self.component_cache_actor.save(refreshing=self.rollback_point_refreshing,
next_action=self.rollback_point_next_action,
... | python | def rollback(self):
"""
push back last rollbackpoint into the cache
:return:
"""
return self.component_cache_actor.save(refreshing=self.rollback_point_refreshing,
next_action=self.rollback_point_next_action,
... | [
"def",
"rollback",
"(",
"self",
")",
":",
"return",
"self",
".",
"component_cache_actor",
".",
"save",
"(",
"refreshing",
"=",
"self",
".",
"rollback_point_refreshing",
",",
"next_action",
"=",
"self",
".",
"rollback_point_next_action",
",",
"json_last_refresh",
"... | push back last rollbackpoint into the cache
:return: | [
"push",
"back",
"last",
"rollbackpoint",
"into",
"the",
"cache"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L831-L840 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedGearService.get_gears_cache_size | def get_gears_cache_size():
"""
:return: the Ariane gears cache size defined by InjectorCachedGearService.cache_id
"""
LOGGER.debug("InjectorCachedGearService.get_gears_cache_size")
ret = None
args = {'properties': {'OPERATION': 'COUNT_GEARS_CACHE',
... | python | def get_gears_cache_size():
"""
:return: the Ariane gears cache size defined by InjectorCachedGearService.cache_id
"""
LOGGER.debug("InjectorCachedGearService.get_gears_cache_size")
ret = None
args = {'properties': {'OPERATION': 'COUNT_GEARS_CACHE',
... | [
"def",
"get_gears_cache_size",
"(",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedGearService.get_gears_cache_size\"",
")",
"ret",
"=",
"None",
"args",
"=",
"{",
"'properties'",
":",
"{",
"'OPERATION'",
":",
"'COUNT_GEARS_CACHE'",
",",
"'CACHE_ID'",
":",
... | :return: the Ariane gears cache size defined by InjectorCachedGearService.cache_id | [
":",
"return",
":",
"the",
"Ariane",
"gears",
"cache",
"size",
"defined",
"by",
"InjectorCachedGearService",
".",
"cache_id"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L898-L915 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedGearService.make_admin_on_demand_service | def make_admin_on_demand_service(injector_gear):
"""
create an admin service to stop or start the linked gear
:param injector_gear: the gear to be linked to this admin service
:return: the service created
"""
LOGGER.debug("InjectorCachedGearService.make_admin_on_demand_se... | python | def make_admin_on_demand_service(injector_gear):
"""
create an admin service to stop or start the linked gear
:param injector_gear: the gear to be linked to this admin service
:return: the service created
"""
LOGGER.debug("InjectorCachedGearService.make_admin_on_demand_se... | [
"def",
"make_admin_on_demand_service",
"(",
"injector_gear",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedGearService.make_admin_on_demand_service\"",
")",
"args",
"=",
"{",
"'service_q'",
":",
"injector_gear",
".",
"id",
",",
"'treatment_callback'",
":",
"in... | create an admin service to stop or start the linked gear
:param injector_gear: the gear to be linked to this admin service
:return: the service created | [
"create",
"an",
"admin",
"service",
"to",
"stop",
"or",
"start",
"the",
"linked",
"gear",
":",
"param",
"injector_gear",
":",
"the",
"gear",
"to",
"be",
"linked",
"to",
"this",
"admin",
"service",
":",
"return",
":",
"the",
"service",
"created"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L918-L930 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedGear.json_2_injector_gear | def json_2_injector_gear(json_obj):
"""
transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedGear
"""
LOGGER.debug("InjectorCachedGear.json_2_injector_gear")
return InjectorCach... | python | def json_2_injector_gear(json_obj):
"""
transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedGear
"""
LOGGER.debug("InjectorCachedGear.json_2_injector_gear")
return InjectorCach... | [
"def",
"json_2_injector_gear",
"(",
"json_obj",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedGear.json_2_injector_gear\"",
")",
"return",
"InjectorCachedGear",
"(",
"gear_id",
"=",
"json_obj",
"[",
"'gearId'",
"]",
",",
"gear_name",
"=",
"json_obj",
"[",
... | transform the JSON return by Ariane server to local object
:param json_obj: the JSON returned by Ariane server
:return: a new InjectorCachedGear | [
"transform",
"the",
"JSON",
"return",
"by",
"Ariane",
"server",
"to",
"local",
"object",
":",
"param",
"json_obj",
":",
"the",
"JSON",
"returned",
"by",
"Ariane",
"server",
":",
"return",
":",
"a",
"new",
"InjectorCachedGear"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L935-L948 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedGear.injector_gear_2_json | def injector_gear_2_json(self):
"""
transform this local object to JSON.
:return: the JSON from this local object
"""
LOGGER.debug("InjectorCachedGear.injector_gear_2_json")
json_obj = {
'gearId': self.id,
'gearName': self.name,
'gearAd... | python | def injector_gear_2_json(self):
"""
transform this local object to JSON.
:return: the JSON from this local object
"""
LOGGER.debug("InjectorCachedGear.injector_gear_2_json")
json_obj = {
'gearId': self.id,
'gearName': self.name,
'gearAd... | [
"def",
"injector_gear_2_json",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedGear.injector_gear_2_json\"",
")",
"json_obj",
"=",
"{",
"'gearId'",
":",
"self",
".",
"id",
",",
"'gearName'",
":",
"self",
".",
"name",
",",
"'gearAdminQueue'",... | transform this local object to JSON.
:return: the JSON from this local object | [
"transform",
"this",
"local",
"object",
"to",
"JSON",
".",
":",
"return",
":",
"the",
"JSON",
"from",
"this",
"local",
"object"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L950-L963 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorCachedGear.save | def save(self, running=None):
"""
save or update this cached gear into the Ariane server cache
:param running: the new running value. if None ignored
:return:
"""
LOGGER.debug("InjectorCachedGear.save")
ret = True
if running is not None:
self.... | python | def save(self, running=None):
"""
save or update this cached gear into the Ariane server cache
:param running: the new running value. if None ignored
:return:
"""
LOGGER.debug("InjectorCachedGear.save")
ret = True
if running is not None:
self.... | [
"def",
"save",
"(",
"self",
",",
"running",
"=",
"None",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorCachedGear.save\"",
")",
"ret",
"=",
"True",
"if",
"running",
"is",
"not",
"None",
":",
"self",
".",
"running",
"=",
"running",
"if",
"self",
"."... | save or update this cached gear into the Ariane server cache
:param running: the new running value. if None ignored
:return: | [
"save",
"or",
"update",
"this",
"cached",
"gear",
"into",
"the",
"Ariane",
"server",
"cache",
":",
"param",
"running",
":",
"the",
"new",
"running",
"value",
".",
"if",
"None",
"ignored",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L987-L1017 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorGearSkeleton.cache | def cache(self, running):
"""
save / update this gear into Ariane server cache
:param running: the new running value (True or False)
:return:
"""
LOGGER.debug("InjectorGearSkeleton.cache")
self.running = running if running is not None else False
return sel... | python | def cache(self, running):
"""
save / update this gear into Ariane server cache
:param running: the new running value (True or False)
:return:
"""
LOGGER.debug("InjectorGearSkeleton.cache")
self.running = running if running is not None else False
return sel... | [
"def",
"cache",
"(",
"self",
",",
"running",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorGearSkeleton.cache\"",
")",
"self",
".",
"running",
"=",
"running",
"if",
"running",
"is",
"not",
"None",
"else",
"False",
"return",
"self",
".",
"cached_gear_acto... | save / update this gear into Ariane server cache
:param running: the new running value (True or False)
:return: | [
"save",
"/",
"update",
"this",
"gear",
"into",
"Ariane",
"server",
"cache",
":",
"param",
"running",
":",
"the",
"new",
"running",
"value",
"(",
"True",
"or",
"False",
")",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L1093-L1101 |
echinopsii/net.echinopsii.ariane.community.cli.python3 | ariane_clip3/injector.py | InjectorGearSkeleton.remove | def remove(self):
"""
remove the gear from the cache and stop this actor
:return:
"""
LOGGER.debug("InjectorGearSkeleton.remove")
ret = self.cached_gear_actor.remove().get()
if self.actor_ref:
self.stop()
return ret | python | def remove(self):
"""
remove the gear from the cache and stop this actor
:return:
"""
LOGGER.debug("InjectorGearSkeleton.remove")
ret = self.cached_gear_actor.remove().get()
if self.actor_ref:
self.stop()
return ret | [
"def",
"remove",
"(",
"self",
")",
":",
"LOGGER",
".",
"debug",
"(",
"\"InjectorGearSkeleton.remove\"",
")",
"ret",
"=",
"self",
".",
"cached_gear_actor",
".",
"remove",
"(",
")",
".",
"get",
"(",
")",
"if",
"self",
".",
"actor_ref",
":",
"self",
".",
... | remove the gear from the cache and stop this actor
:return: | [
"remove",
"the",
"gear",
"from",
"the",
"cache",
"and",
"stop",
"this",
"actor",
":",
"return",
":"
] | train | https://github.com/echinopsii/net.echinopsii.ariane.community.cli.python3/blob/0a7feddebf66fee4bef38d64f456d93a7e9fcd68/ariane_clip3/injector.py#L1103-L1112 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.