repository_name
stringlengths
5
67
func_path_in_repository
stringlengths
4
234
func_name
stringlengths
0
314
whole_func_string
stringlengths
52
3.87M
language
stringclasses
6 values
func_code_string
stringlengths
52
3.87M
func_code_tokens
listlengths
15
672k
func_documentation_string
stringlengths
1
47.2k
func_documentation_tokens
listlengths
1
3.92k
split_name
stringclasses
1 value
func_code_url
stringlengths
85
339
Arkq/flake8-requirements
src/flake8_requirements/checker.py
Flake8Checker.get_setup
def get_setup(cls): """Get package setup.""" try: with open("setup.py") as f: return SetupVisitor(ast.parse(f.read())) except IOError as e: LOG.warning("Couldn't open setup file: %s", e) return SetupVisitor(ast.parse(""))
python
def get_setup(cls): """Get package setup.""" try: with open("setup.py") as f: return SetupVisitor(ast.parse(f.read())) except IOError as e: LOG.warning("Couldn't open setup file: %s", e) return SetupVisitor(ast.parse(""))
[ "def", "get_setup", "(", "cls", ")", ":", "try", ":", "with", "open", "(", "\"setup.py\"", ")", "as", "f", ":", "return", "SetupVisitor", "(", "ast", ".", "parse", "(", "f", ".", "read", "(", ")", ")", ")", "except", "IOError", "as", "e", ":", "L...
Get package setup.
[ "Get", "package", "setup", "." ]
train
https://github.com/Arkq/flake8-requirements/blob/d7cb84af2429a63635528b531111a5da527bf2d1/src/flake8_requirements/checker.py#L305-L312
Arkq/flake8-requirements
src/flake8_requirements/checker.py
Flake8Checker.run
def run(self): """Run checker.""" def split(module): """Split module into submodules.""" return tuple(module.split(".")) def modcmp(lib=(), test=()): """Compare import modules.""" if len(lib) > len(test): return False ...
python
def run(self): """Run checker.""" def split(module): """Split module into submodules.""" return tuple(module.split(".")) def modcmp(lib=(), test=()): """Compare import modules.""" if len(lib) > len(test): return False ...
[ "def", "run", "(", "self", ")", ":", "def", "split", "(", "module", ")", ":", "\"\"\"Split module into submodules.\"\"\"", "return", "tuple", "(", "module", ".", "split", "(", "\".\"", ")", ")", "def", "modcmp", "(", "lib", "=", "(", ")", ",", "test", ...
Run checker.
[ "Run", "checker", "." ]
train
https://github.com/Arkq/flake8-requirements/blob/d7cb84af2429a63635528b531111a5da527bf2d1/src/flake8_requirements/checker.py#L322-L385
joequant/cryptoexchange
cryptoexchange/api796.py
getUserInfoError
def getUserInfoError(sAccessToken): """ May be return {u'msg': u'Access_token repealed', u'errno': u'-102', u'data': []} """ import urllib.request, urllib.parse, urllib.error payload = urllib.parse.urlencode({'access_token': sAccessToken}) c = http.client.HTTPSConnection('796.com') c.req...
python
def getUserInfoError(sAccessToken): """ May be return {u'msg': u'Access_token repealed', u'errno': u'-102', u'data': []} """ import urllib.request, urllib.parse, urllib.error payload = urllib.parse.urlencode({'access_token': sAccessToken}) c = http.client.HTTPSConnection('796.com') c.req...
[ "def", "getUserInfoError", "(", "sAccessToken", ")", ":", "import", "urllib", ".", "request", ",", "urllib", ".", "parse", ",", "urllib", ".", "error", "payload", "=", "urllib", ".", "parse", ".", "urlencode", "(", "{", "'access_token'", ":", "sAccessToken",...
May be return {u'msg': u'Access_token repealed', u'errno': u'-102', u'data': []}
[ "May", "be", "return", "{", "u", "msg", ":", "u", "Access_token", "repealed", "u", "errno", ":", "u", "-", "102", "u", "data", ":", "[]", "}" ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/api796.py#L69-L80
cmcdowell/weatherpy
weatherpy/image.py
Image.as_html
def as_html(self): """ Returns the image of the Yahoo rss feed as an html string """ return '<a href="{0}"><img height="{1}" width="{2}" src="{3}" alt="{4}"></a>'.format( self.link, self.height, self.width, self.url, self.title)
python
def as_html(self): """ Returns the image of the Yahoo rss feed as an html string """ return '<a href="{0}"><img height="{1}" width="{2}" src="{3}" alt="{4}"></a>'.format( self.link, self.height, self.width, self.url, self.title)
[ "def", "as_html", "(", "self", ")", ":", "return", "'<a href=\"{0}\"><img height=\"{1}\" width=\"{2}\" src=\"{3}\" alt=\"{4}\"></a>'", ".", "format", "(", "self", ".", "link", ",", "self", ".", "height", ",", "self", ".", "width", ",", "self", ".", "url", ",", "...
Returns the image of the Yahoo rss feed as an html string
[ "Returns", "the", "image", "of", "the", "Yahoo", "rss", "feed", "as", "an", "html", "string" ]
train
https://github.com/cmcdowell/weatherpy/blob/7da7bed9db946dfab9318d67aab5fbda1e4fed21/weatherpy/image.py#L22-L28
immstudios/nxtools
nxtools/media/ffprobe.py
ffprobe
def ffprobe(input_file, verbose=False): """Runs ffprobe on file and returns python dict with result""" if isinstance(input_file, FileObject): exists = input_file.exists path = input_file.path elif type(input_file) in string_types: exists = os.path.exists(input_file) path = in...
python
def ffprobe(input_file, verbose=False): """Runs ffprobe on file and returns python dict with result""" if isinstance(input_file, FileObject): exists = input_file.exists path = input_file.path elif type(input_file) in string_types: exists = os.path.exists(input_file) path = in...
[ "def", "ffprobe", "(", "input_file", ",", "verbose", "=", "False", ")", ":", "if", "isinstance", "(", "input_file", ",", "FileObject", ")", ":", "exists", "=", "input_file", ".", "exists", "path", "=", "input_file", ".", "path", "elif", "type", "(", "inp...
Runs ffprobe on file and returns python dict with result
[ "Runs", "ffprobe", "on", "file", "and", "returns", "python", "dict", "with", "result" ]
train
https://github.com/immstudios/nxtools/blob/8c30213c61aec460c648d5e9ae7ce79dfb7b4b9a/nxtools/media/ffprobe.py#L38-L70
ytjia/utils-py
utils_py/decorator.py
class_check_para
def class_check_para(**kw): """ force check accept and return, decorator, @class_check_para(accept=, returns=, mail=) :param kw: :return: """ try: def decorator(f): def new_f(*args): if "accepts" in kw: assert len(args) == len(kw["accep...
python
def class_check_para(**kw): """ force check accept and return, decorator, @class_check_para(accept=, returns=, mail=) :param kw: :return: """ try: def decorator(f): def new_f(*args): if "accepts" in kw: assert len(args) == len(kw["accep...
[ "def", "class_check_para", "(", "*", "*", "kw", ")", ":", "try", ":", "def", "decorator", "(", "f", ")", ":", "def", "new_f", "(", "*", "args", ")", ":", "if", "\"accepts\"", "in", "kw", ":", "assert", "len", "(", "args", ")", "==", "len", "(", ...
force check accept and return, decorator, @class_check_para(accept=, returns=, mail=) :param kw: :return:
[ "force", "check", "accept", "and", "return", "decorator" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/decorator.py#L7-L42
ytjia/utils-py
utils_py/decorator.py
decorator_info
def decorator_info(f_name, expected, actual, flag): """ Convenience function returns nicely formatted error/warning msg. :param f_name: :param expected: :param actual: :param flag: :return: """ format = lambda types: ', '.join([str(t).split("'")[1] for t in types]) expected, actu...
python
def decorator_info(f_name, expected, actual, flag): """ Convenience function returns nicely formatted error/warning msg. :param f_name: :param expected: :param actual: :param flag: :return: """ format = lambda types: ', '.join([str(t).split("'")[1] for t in types]) expected, actu...
[ "def", "decorator_info", "(", "f_name", ",", "expected", ",", "actual", ",", "flag", ")", ":", "format", "=", "lambda", "types", ":", "', '", ".", "join", "(", "[", "str", "(", "t", ")", ".", "split", "(", "\"'\"", ")", "[", "1", "]", "for", "t",...
Convenience function returns nicely formatted error/warning msg. :param f_name: :param expected: :param actual: :param flag: :return:
[ "Convenience", "function", "returns", "nicely", "formatted", "error", "/", "warning", "msg", ".", ":", "param", "f_name", ":", ":", "param", "expected", ":", ":", "param", "actual", ":", ":", "param", "flag", ":", ":", "return", ":" ]
train
https://github.com/ytjia/utils-py/blob/68039b367e2e38fdecf234ecc625406b9e203ec0/utils_py/decorator.py#L45-L60
spyoungtech/behave-classy
features/steps/class_steps.py
ExtendedSteps.pay_loan
def pay_loan(self, loan_name): """additional when step for loan payments""" loan_payments = { 'student': 600, 'car': 200 } payment_amount = loan_payments[loan_name] self.withdraw(payment_amount)
python
def pay_loan(self, loan_name): """additional when step for loan payments""" loan_payments = { 'student': 600, 'car': 200 } payment_amount = loan_payments[loan_name] self.withdraw(payment_amount)
[ "def", "pay_loan", "(", "self", ",", "loan_name", ")", ":", "loan_payments", "=", "{", "'student'", ":", "600", ",", "'car'", ":", "200", "}", "payment_amount", "=", "loan_payments", "[", "loan_name", "]", "self", ".", "withdraw", "(", "payment_amount", ")...
additional when step for loan payments
[ "additional", "when", "step", "for", "loan", "payments" ]
train
https://github.com/spyoungtech/behave-classy/blob/a5637a13768c3c2b845d73fafd1dc41a4a5311c5/features/steps/class_steps.py#L56-L63
spyoungtech/behave-classy
features/steps/class_steps.py
ExtendedSteps.withdraw
def withdraw(self, amount): """Extends withdraw method to make sure enough funds are in the account, then call withdraw from superclass""" if amount > self.balance: raise ValueError('Insufficient Funds') super().withdraw(amount)
python
def withdraw(self, amount): """Extends withdraw method to make sure enough funds are in the account, then call withdraw from superclass""" if amount > self.balance: raise ValueError('Insufficient Funds') super().withdraw(amount)
[ "def", "withdraw", "(", "self", ",", "amount", ")", ":", "if", "amount", ">", "self", ".", "balance", ":", "raise", "ValueError", "(", "'Insufficient Funds'", ")", "super", "(", ")", ".", "withdraw", "(", "amount", ")" ]
Extends withdraw method to make sure enough funds are in the account, then call withdraw from superclass
[ "Extends", "withdraw", "method", "to", "make", "sure", "enough", "funds", "are", "in", "the", "account", "then", "call", "withdraw", "from", "superclass" ]
train
https://github.com/spyoungtech/behave-classy/blob/a5637a13768c3c2b845d73fafd1dc41a4a5311c5/features/steps/class_steps.py#L65-L69
spyoungtech/behave-classy
features/steps/class_steps.py
ExtendedSteps.compare_balance
def compare_balance(self, operator, or_equals, amount): """Additional step using regex matcher to compare the current balance with some number""" amount = int(amount) if operator == 'less': if or_equals: self.assertLessEqual(self.balance, amount) else: ...
python
def compare_balance(self, operator, or_equals, amount): """Additional step using regex matcher to compare the current balance with some number""" amount = int(amount) if operator == 'less': if or_equals: self.assertLessEqual(self.balance, amount) else: ...
[ "def", "compare_balance", "(", "self", ",", "operator", ",", "or_equals", ",", "amount", ")", ":", "amount", "=", "int", "(", "amount", ")", "if", "operator", "==", "'less'", ":", "if", "or_equals", ":", "self", ".", "assertLessEqual", "(", "self", ".", ...
Additional step using regex matcher to compare the current balance with some number
[ "Additional", "step", "using", "regex", "matcher", "to", "compare", "the", "current", "balance", "with", "some", "number" ]
train
https://github.com/spyoungtech/behave-classy/blob/a5637a13768c3c2b845d73fafd1dc41a4a5311c5/features/steps/class_steps.py#L72-L83
theosysbio/means
src/means/approximation/mea/closure_scalar.py
ClosureBase._compute_closed_central_moments
def _compute_closed_central_moments(self, central_from_raw_exprs, n_counter, k_counter): r""" Computes parametric expressions (e.g. in terms of mean, variance, covariances) for all central moments up to max_order + 1 order. :param central_from_raw_exprs: the expression of central moment...
python
def _compute_closed_central_moments(self, central_from_raw_exprs, n_counter, k_counter): r""" Computes parametric expressions (e.g. in terms of mean, variance, covariances) for all central moments up to max_order + 1 order. :param central_from_raw_exprs: the expression of central moment...
[ "def", "_compute_closed_central_moments", "(", "self", ",", "central_from_raw_exprs", ",", "n_counter", ",", "k_counter", ")", ":", "closed_raw_moments", "=", "self", ".", "_compute_raw_moments", "(", "n_counter", ",", "k_counter", ")", "assert", "(", "len", "(", ...
r""" Computes parametric expressions (e.g. in terms of mean, variance, covariances) for all central moments up to max_order + 1 order. :param central_from_raw_exprs: the expression of central moments in terms of raw moments :param n_counter: a list of :class:`~means.core.descriptors.Mom...
[ "r", "Computes", "parametric", "expressions", "(", "e", ".", "g", ".", "in", "terms", "of", "mean", "variance", "covariances", ")", "for", "all", "central", "moments", "up", "to", "max_order", "+", "1", "order", "." ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_scalar.py#L48-L71
theosysbio/means
src/means/approximation/mea/closure_scalar.py
ClosureBase.close
def close(self, mfk, central_from_raw_exprs, n_counter, k_counter): """ In MFK, replaces symbol for high order (order == max_order+1) by parametric expressions. That is expressions depending on lower order moments such as means, variances, covariances and so on. :param mfk: the right h...
python
def close(self, mfk, central_from_raw_exprs, n_counter, k_counter): """ In MFK, replaces symbol for high order (order == max_order+1) by parametric expressions. That is expressions depending on lower order moments such as means, variances, covariances and so on. :param mfk: the right h...
[ "def", "close", "(", "self", ",", "mfk", ",", "central_from_raw_exprs", ",", "n_counter", ",", "k_counter", ")", ":", "# we obtain expressions for central moments in terms of variances/covariances", "closed_central_moments", "=", "self", ".", "_compute_closed_central_moments", ...
In MFK, replaces symbol for high order (order == max_order+1) by parametric expressions. That is expressions depending on lower order moments such as means, variances, covariances and so on. :param mfk: the right hand side equations containing symbols for high order central moments :param centr...
[ "In", "MFK", "replaces", "symbol", "for", "high", "order", "(", "order", "==", "max_order", "+", "1", ")", "by", "parametric", "expressions", ".", "That", "is", "expressions", "depending", "on", "lower", "order", "moments", "such", "as", "means", "variances"...
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_scalar.py#L74-L105
theosysbio/means
src/means/approximation/mea/closure_scalar.py
ClosureBase._set_mixed_moments_to_zero
def _set_mixed_moments_to_zero(self, closed_central_moments, n_counter): r""" In univariate case, set the cross-terms to 0. :param closed_central_moments: matrix of closed central moment :param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments ...
python
def _set_mixed_moments_to_zero(self, closed_central_moments, n_counter): r""" In univariate case, set the cross-terms to 0. :param closed_central_moments: matrix of closed central moment :param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments ...
[ "def", "_set_mixed_moments_to_zero", "(", "self", ",", "closed_central_moments", ",", "n_counter", ")", ":", "positive_n_counter", "=", "[", "n", "for", "n", "in", "n_counter", "if", "n", ".", "order", ">", "1", "]", "if", "self", ".", "is_multivariate", ":"...
r""" In univariate case, set the cross-terms to 0. :param closed_central_moments: matrix of closed central moment :param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moments :type n_counter: list[:class:`~means.core.descriptors.Moment`] :re...
[ "r", "In", "univariate", "case", "set", "the", "cross", "-", "terms", "to", "0", "." ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_scalar.py#L107-L121
theosysbio/means
src/means/approximation/mea/closure_scalar.py
ScalarClosure._compute_closed_central_moments
def _compute_closed_central_moments(self, central_from_raw_exprs, n_counter, k_counter): r""" Replace raw moment terms in central moment expressions by parameters (e.g. mean, variance, covariances) :param central_from_raw_exprs: the expression of central moments in terms of raw moments ...
python
def _compute_closed_central_moments(self, central_from_raw_exprs, n_counter, k_counter): r""" Replace raw moment terms in central moment expressions by parameters (e.g. mean, variance, covariances) :param central_from_raw_exprs: the expression of central moments in terms of raw moments ...
[ "def", "_compute_closed_central_moments", "(", "self", ",", "central_from_raw_exprs", ",", "n_counter", ",", "k_counter", ")", ":", "closed_central_moments", "=", "sp", ".", "Matrix", "(", "[", "sp", ".", "Integer", "(", "self", ".", "__value", ")", "]", "*", ...
r""" Replace raw moment terms in central moment expressions by parameters (e.g. mean, variance, covariances) :param central_from_raw_exprs: the expression of central moments in terms of raw moments :param n_counter: a list of :class:`~means.core.descriptors.Moment`\s representing central moment...
[ "r", "Replace", "raw", "moment", "terms", "in", "central", "moment", "expressions", "by", "parameters", "(", "e", ".", "g", ".", "mean", "variance", "covariances", ")" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/approximation/mea/closure_scalar.py#L143-L157
ND-CSE-30151/tock
tock/graphs.py
read_tgf
def read_tgf(filename): """Reads a file in Trivial Graph Format.""" g = Graph() with open(filename) as file: states = {} # Nodes for line in file: line = line.strip() if line == "": continue elif line == "#": break...
python
def read_tgf(filename): """Reads a file in Trivial Graph Format.""" g = Graph() with open(filename) as file: states = {} # Nodes for line in file: line = line.strip() if line == "": continue elif line == "#": break...
[ "def", "read_tgf", "(", "filename", ")", ":", "g", "=", "Graph", "(", ")", "with", "open", "(", "filename", ")", "as", "file", ":", "states", "=", "{", "}", "# Nodes", "for", "line", "in", "file", ":", "line", "=", "line", ".", "strip", "(", ")",...
Reads a file in Trivial Graph Format.
[ "Reads", "a", "file", "in", "Trivial", "Graph", "Format", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/graphs.py#L203-L231
ND-CSE-30151/tock
tock/graphs.py
Graph.only_path
def only_path(self): """Finds the only path from the start node. If there is more than one, raises ValueError.""" start = [v for v in self.nodes if self.nodes[v].get('start', False)] if len(start) != 1: raise ValueError("graph does not have exactly one start node") ...
python
def only_path(self): """Finds the only path from the start node. If there is more than one, raises ValueError.""" start = [v for v in self.nodes if self.nodes[v].get('start', False)] if len(start) != 1: raise ValueError("graph does not have exactly one start node") ...
[ "def", "only_path", "(", "self", ")", ":", "start", "=", "[", "v", "for", "v", "in", "self", ".", "nodes", "if", "self", ".", "nodes", "[", "v", "]", ".", "get", "(", "'start'", ",", "False", ")", "]", "if", "len", "(", "start", ")", "!=", "1...
Finds the only path from the start node. If there is more than one, raises ValueError.
[ "Finds", "the", "only", "path", "from", "the", "start", "node", ".", "If", "there", "is", "more", "than", "one", "raises", "ValueError", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/graphs.py#L44-L63
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._init_catalog
def _init_catalog(self, proxy=None, runtime=None): """Initialize this session as an OsidCatalog based session.""" self._init_proxy_and_runtime(proxy, runtime) osid_name = self._session_namespace.split('.')[0] try: config = self._runtime.get_configuration() paramet...
python
def _init_catalog(self, proxy=None, runtime=None): """Initialize this session as an OsidCatalog based session.""" self._init_proxy_and_runtime(proxy, runtime) osid_name = self._session_namespace.split('.')[0] try: config = self._runtime.get_configuration() paramet...
[ "def", "_init_catalog", "(", "self", ",", "proxy", "=", "None", ",", "runtime", "=", "None", ")", ":", "self", ".", "_init_proxy_and_runtime", "(", "proxy", ",", "runtime", ")", "osid_name", "=", "self", ".", "_session_namespace", ".", "split", "(", "'.'",...
Initialize this session as an OsidCatalog based session.
[ "Initialize", "this", "session", "as", "an", "OsidCatalog", "based", "session", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L96-L106
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._init_object
def _init_object(self, catalog_id, proxy, runtime, db_name, cat_name, cat_class): """Initialize this session an OsidObject based session.""" self._catalog_identifier = None self._init_proxy_and_runtime(proxy, runtime) uses_cataloging = False if catalog_id is not None and catalog...
python
def _init_object(self, catalog_id, proxy, runtime, db_name, cat_name, cat_class): """Initialize this session an OsidObject based session.""" self._catalog_identifier = None self._init_proxy_and_runtime(proxy, runtime) uses_cataloging = False if catalog_id is not None and catalog...
[ "def", "_init_object", "(", "self", ",", "catalog_id", ",", "proxy", ",", "runtime", ",", "db_name", ",", "cat_name", ",", "cat_class", ")", ":", "self", ".", "_catalog_identifier", "=", "None", "self", ".", "_init_proxy_and_runtime", "(", "proxy", ",", "run...
Initialize this session an OsidObject based session.
[ "Initialize", "this", "session", "an", "OsidObject", "based", "session", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L108-L151
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._get_phantom_root_catalog
def _get_phantom_root_catalog(self, cat_name, cat_class): """Get's the catalog id corresponding to the root of all implementation catalogs.""" catalog_map = make_catalog_map(cat_name, identifier=PHANTOM_ROOT_IDENTIFIER) return cat_class(osid_object_map=catalog_map, runtime=self._runtime, proxy=s...
python
def _get_phantom_root_catalog(self, cat_name, cat_class): """Get's the catalog id corresponding to the root of all implementation catalogs.""" catalog_map = make_catalog_map(cat_name, identifier=PHANTOM_ROOT_IDENTIFIER) return cat_class(osid_object_map=catalog_map, runtime=self._runtime, proxy=s...
[ "def", "_get_phantom_root_catalog", "(", "self", ",", "cat_name", ",", "cat_class", ")", ":", "catalog_map", "=", "make_catalog_map", "(", "cat_name", ",", "identifier", "=", "PHANTOM_ROOT_IDENTIFIER", ")", "return", "cat_class", "(", "osid_object_map", "=", "catalo...
Get's the catalog id corresponding to the root of all implementation catalogs.
[ "Get", "s", "the", "catalog", "id", "corresponding", "to", "the", "root", "of", "all", "implementation", "catalogs", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L153-L156
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._create_orchestrated_cat
def _create_orchestrated_cat(self, foreign_catalog_id, db_name, cat_name): """Creates a catalog in the current service orchestrated with a foreign service Id.""" if (foreign_catalog_id.identifier_namespace == db_name + '.' + cat_name and foreign_catalog_id.authority == self._authority): ...
python
def _create_orchestrated_cat(self, foreign_catalog_id, db_name, cat_name): """Creates a catalog in the current service orchestrated with a foreign service Id.""" if (foreign_catalog_id.identifier_namespace == db_name + '.' + cat_name and foreign_catalog_id.authority == self._authority): ...
[ "def", "_create_orchestrated_cat", "(", "self", ",", "foreign_catalog_id", ",", "db_name", ",", "cat_name", ")", ":", "if", "(", "foreign_catalog_id", ".", "identifier_namespace", "==", "db_name", "+", "'.'", "+", "cat_name", "and", "foreign_catalog_id", ".", "aut...
Creates a catalog in the current service orchestrated with a foreign service Id.
[ "Creates", "a", "catalog", "in", "the", "current", "service", "orchestrated", "with", "a", "foreign", "service", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L158-L185
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._get_id
def _get_id(self, id_, pkg_name): """ Returns the primary id given an alias. If the id provided is not in the alias table, it will simply be returned as is. Only looks within the Id Alias namespace for the session package """ collection = JSONClientValidated('i...
python
def _get_id(self, id_, pkg_name): """ Returns the primary id given an alias. If the id provided is not in the alias table, it will simply be returned as is. Only looks within the Id Alias namespace for the session package """ collection = JSONClientValidated('i...
[ "def", "_get_id", "(", "self", ",", "id_", ",", "pkg_name", ")", ":", "collection", "=", "JSONClientValidated", "(", "'id'", ",", "collection", "=", "pkg_name", "+", "'Ids'", ",", "runtime", "=", "self", ".", "_runtime", ")", "try", ":", "result", "=", ...
Returns the primary id given an alias. If the id provided is not in the alias table, it will simply be returned as is. Only looks within the Id Alias namespace for the session package
[ "Returns", "the", "primary", "id", "given", "an", "alias", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L191-L209
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._alias_id
def _alias_id(self, primary_id, equivalent_id): """Adds the given equivalent_id as an alias for primary_id if possible""" pkg_name = primary_id.get_identifier_namespace().split('.')[0] obj_name = primary_id.get_identifier_namespace().split('.')[1] collection = JSONClientValidated(pkg_nam...
python
def _alias_id(self, primary_id, equivalent_id): """Adds the given equivalent_id as an alias for primary_id if possible""" pkg_name = primary_id.get_identifier_namespace().split('.')[0] obj_name = primary_id.get_identifier_namespace().split('.')[1] collection = JSONClientValidated(pkg_nam...
[ "def", "_alias_id", "(", "self", ",", "primary_id", ",", "equivalent_id", ")", ":", "pkg_name", "=", "primary_id", ".", "get_identifier_namespace", "(", ")", ".", "split", "(", "'.'", ")", "[", "0", "]", "obj_name", "=", "primary_id", ".", "get_identifier_na...
Adds the given equivalent_id as an alias for primary_id if possible
[ "Adds", "the", "given", "equivalent_id", "as", "an", "alias", "for", "primary_id", "if", "possible" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L211-L235
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._get_catalog_idstrs
def _get_catalog_idstrs(self): """Returns the proper list of catalog idstrs based on catalog view""" if self._catalog_view == ISOLATED: return [str(self._catalog_id)] else: return self._get_descendent_cat_idstrs(self._catalog_id)
python
def _get_catalog_idstrs(self): """Returns the proper list of catalog idstrs based on catalog view""" if self._catalog_view == ISOLATED: return [str(self._catalog_id)] else: return self._get_descendent_cat_idstrs(self._catalog_id)
[ "def", "_get_catalog_idstrs", "(", "self", ")", ":", "if", "self", ".", "_catalog_view", "==", "ISOLATED", ":", "return", "[", "str", "(", "self", ".", "_catalog_id", ")", "]", "else", ":", "return", "self", ".", "_get_descendent_cat_idstrs", "(", "self", ...
Returns the proper list of catalog idstrs based on catalog view
[ "Returns", "the", "proper", "list", "of", "catalog", "idstrs", "based", "on", "catalog", "view" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L237-L242
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._get_descendent_cat_idstrs
def _get_descendent_cat_idstrs(self, cat_id, hierarchy_session=None): """Recursively returns a list of all descendent catalog ids, inclusive""" def get_descendent_ids(h_session): idstr_list = [str(cat_id)] if h_session is None: pkg_name = cat_id.get_identifier_nam...
python
def _get_descendent_cat_idstrs(self, cat_id, hierarchy_session=None): """Recursively returns a list of all descendent catalog ids, inclusive""" def get_descendent_ids(h_session): idstr_list = [str(cat_id)] if h_session is None: pkg_name = cat_id.get_identifier_nam...
[ "def", "_get_descendent_cat_idstrs", "(", "self", ",", "cat_id", ",", "hierarchy_session", "=", "None", ")", ":", "def", "get_descendent_ids", "(", "h_session", ")", ":", "idstr_list", "=", "[", "str", "(", "cat_id", ")", "]", "if", "h_session", "is", "None"...
Recursively returns a list of all descendent catalog ids, inclusive
[ "Recursively", "returns", "a", "list", "of", "all", "descendent", "catalog", "ids", "inclusive" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L244-L320
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._effective_view_filter
def _effective_view_filter(self): """Returns the mongodb relationship filter for effective views""" if self._effective_view == EFFECTIVE: now = datetime.datetime.utcnow() return {'startDate': {'$$lte': now}, 'endDate': {'$$gte': now}} return {}
python
def _effective_view_filter(self): """Returns the mongodb relationship filter for effective views""" if self._effective_view == EFFECTIVE: now = datetime.datetime.utcnow() return {'startDate': {'$$lte': now}, 'endDate': {'$$gte': now}} return {}
[ "def", "_effective_view_filter", "(", "self", ")", ":", "if", "self", ".", "_effective_view", "==", "EFFECTIVE", ":", "now", "=", "datetime", ".", "datetime", ".", "utcnow", "(", ")", "return", "{", "'startDate'", ":", "{", "'$$lte'", ":", "now", "}", ",...
Returns the mongodb relationship filter for effective views
[ "Returns", "the", "mongodb", "relationship", "filter", "for", "effective", "views" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L344-L349
mitsei/dlkit
dlkit/json_/osid/sessions.py
OsidSession._view_filter
def _view_filter(self): """ Returns the mongodb catalog filter for isolated or federated views. This also searches across all underlying catalogs in federated catalog views. Real authz for controlling access to underlying catalogs will need to be managed in an adapter above the ...
python
def _view_filter(self): """ Returns the mongodb catalog filter for isolated or federated views. This also searches across all underlying catalogs in federated catalog views. Real authz for controlling access to underlying catalogs will need to be managed in an adapter above the ...
[ "def", "_view_filter", "(", "self", ")", ":", "if", "self", ".", "_is_phantom_root_federated", "(", ")", ":", "return", "{", "}", "idstr_list", "=", "self", ".", "_get_catalog_idstrs", "(", ")", "return", "{", "'assigned'", "+", "self", ".", "_catalog_name",...
Returns the mongodb catalog filter for isolated or federated views. This also searches across all underlying catalogs in federated catalog views. Real authz for controlling access to underlying catalogs will need to be managed in an adapter above the pay grade of this implementation.
[ "Returns", "the", "mongodb", "catalog", "filter", "for", "isolated", "or", "federated", "views", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/osid/sessions.py#L351-L364
MacHu-GWU/docfly-project
docfly/pkg/picage/model.py
Package.walk
def walk(self): """ A generator that walking through all sub packages and sub modules. 1. current package object (包对象) 2. current package's parent (当前包对象的母包) 3. list of sub packages (所有子包) 4. list of sub modules (所有模块) """ yield ( self, ...
python
def walk(self): """ A generator that walking through all sub packages and sub modules. 1. current package object (包对象) 2. current package's parent (当前包对象的母包) 3. list of sub packages (所有子包) 4. list of sub modules (所有模块) """ yield ( self, ...
[ "def", "walk", "(", "self", ")", ":", "yield", "(", "self", ",", "self", ".", "parent", ",", "list", "(", "self", ".", "sub_packages", ".", "values", "(", ")", ")", ",", "list", "(", "self", ".", "sub_modules", ".", "values", "(", ")", ")", ",", ...
A generator that walking through all sub packages and sub modules. 1. current package object (包对象) 2. current package's parent (当前包对象的母包) 3. list of sub packages (所有子包) 4. list of sub modules (所有模块)
[ "A", "generator", "that", "walking", "through", "all", "sub", "packages", "and", "sub", "modules", "." ]
train
https://github.com/MacHu-GWU/docfly-project/blob/46da8a9793211301c3ebc12d195228dbf79fdfec/docfly/pkg/picage/model.py#L184-L202
MacHu-GWU/docfly-project
docfly/pkg/picage/model.py
Package._tree_view_builder
def _tree_view_builder(self, indent=0, is_root=True): """ Build a text to represent the package structure. """ def pad_text(indent): return " " * indent + "|-- " lines = list() if is_root: lines.append(SP_DIR) lines.append( ...
python
def _tree_view_builder(self, indent=0, is_root=True): """ Build a text to represent the package structure. """ def pad_text(indent): return " " * indent + "|-- " lines = list() if is_root: lines.append(SP_DIR) lines.append( ...
[ "def", "_tree_view_builder", "(", "self", ",", "indent", "=", "0", ",", "is_root", "=", "True", ")", ":", "def", "pad_text", "(", "indent", ")", ":", "return", "\" \"", "*", "indent", "+", "\"|-- \"", "lines", "=", "list", "(", ")", "if", "is_root",...
Build a text to represent the package structure.
[ "Build", "a", "text", "to", "represent", "the", "package", "structure", "." ]
train
https://github.com/MacHu-GWU/docfly-project/blob/46da8a9793211301c3ebc12d195228dbf79fdfec/docfly/pkg/picage/model.py#L204-L242
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
Asset.get_object_map
def get_object_map(self): """stub""" obj_map = self._payload.get_object_map() obj_map['assetContents'] = [] for asset_content in self.get_asset_contents(): obj_map['assetContents'].append(asset_content.object_map) return obj_map
python
def get_object_map(self): """stub""" obj_map = self._payload.get_object_map() obj_map['assetContents'] = [] for asset_content in self.get_asset_contents(): obj_map['assetContents'].append(asset_content.object_map) return obj_map
[ "def", "get_object_map", "(", "self", ")", ":", "obj_map", "=", "self", ".", "_payload", ".", "get_object_map", "(", ")", "obj_map", "[", "'assetContents'", "]", "=", "[", "]", "for", "asset_content", "in", "self", ".", "get_asset_contents", "(", ")", ":",...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L467-L473
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
AssetContent.get_data
def get_data(self): """Gets the asset content data. return: (osid.transport.DataInputStream) - the length of the content data raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* # gets you a file-like ...
python
def get_data(self): """Gets the asset content data. return: (osid.transport.DataInputStream) - the length of the content data raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* # gets you a file-like ...
[ "def", "get_data", "(", "self", ")", ":", "# read the file from self.get_url()", "# return the file object to be streamed?", "url", "=", "self", ".", "_payload", ".", "get_url", "(", ")", "file_handle", "=", "codecs", ".", "open", "(", "url", ",", "'r'", ",", "e...
Gets the asset content data. return: (osid.transport.DataInputStream) - the length of the content data raise: OperationFailed - unable to complete request *compliance: mandatory -- This method must be implemented.* # gets you a file-like object...not sure if it will be...
[ "Gets", "the", "asset", "content", "data", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L1158-L1180
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
AssetContent.get_url
def get_url(self): """Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # construct the URL from r...
python
def get_url(self): """Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.* """ # construct the URL from r...
[ "def", "get_url", "(", "self", ")", ":", "# construct the URL from runtime's FILESYSTEM location param", "# plus what we know about the location of repository / assetContents", "# have to get repositoryId from the asset?", "# return self._payload.get_url()", "url", "=", "'/repository/reposit...
Gets the URL associated with this content for web-based retrieval. return: (string) - the url for this data raise: IllegalState - ``has_url()`` is ``false`` *compliance: mandatory -- This method must be implemented.*
[ "Gets", "the", "URL", "associated", "with", "this", "content", "for", "web", "-", "based", "retrieval", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L1194-L1214
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
AssetContent.get_object_map
def get_object_map(self): """stub""" obj_map = self._payload.get_object_map() obj_map.update({'url': self.get_url()}) # obj_map['recordTypeIds'].append(str(FILESYSTEM_ASSET_CONTENT_RECORD_TYPE)) return obj_map
python
def get_object_map(self): """stub""" obj_map = self._payload.get_object_map() obj_map.update({'url': self.get_url()}) # obj_map['recordTypeIds'].append(str(FILESYSTEM_ASSET_CONTENT_RECORD_TYPE)) return obj_map
[ "def", "get_object_map", "(", "self", ")", ":", "obj_map", "=", "self", ".", "_payload", ".", "get_object_map", "(", ")", "obj_map", ".", "update", "(", "{", "'url'", ":", "self", ".", "get_url", "(", ")", "}", ")", "# obj_map['recordTypeIds'].append(str(FIL...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L1242-L1247
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
AssetContentForm.set_data
def set_data(self, data=None): """Sets the content data. arg: data (osid.transport.DataInputStream): the content data raise: InvalidArgument - ``data`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``data`` is ``null`` *co...
python
def set_data(self, data=None): """Sets the content data. arg: data (osid.transport.DataInputStream): the content data raise: InvalidArgument - ``data`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``data`` is ``null`` *co...
[ "def", "set_data", "(", "self", ",", "data", "=", "None", ")", ":", "def", "has_secondary_storage", "(", ")", ":", "return", "'secondary_data_store_path'", "in", "self", ".", "_config_map", "extension", "=", "data", ".", "name", ".", "split", "(", "'.'", "...
Sets the content data. arg: data (osid.transport.DataInputStream): the content data raise: InvalidArgument - ``data`` is invalid raise: NoAccess - ``Metadata.isReadOnly()`` is ``true`` raise: NullArgument - ``data`` is ``null`` *compliance: mandatory -- This method must be...
[ "Sets", "the", "content", "data", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L1342-L1403
mitsei/dlkit
dlkit/filesystem_adapter/repository/objects.py
AssetContentForm.clear_data
def clear_data(self): """Removes the content data. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Removes the item from filesystem and resets URL...
python
def clear_data(self): """Removes the content data. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.* """ # Removes the item from filesystem and resets URL...
[ "def", "clear_data", "(", "self", ")", ":", "# Removes the item from filesystem and resets URL to ''", "url", "=", "self", ".", "get_url", "(", ")", "# try to clear from payload first, in case that fails we won't mess with AWS", "self", ".", "_payload", ".", "clear_url", "(",...
Removes the content data. raise: NoAccess - ``Metadata.isRequired()`` is ``true`` or ``Metadata.isReadOnly()`` is ``true`` *compliance: mandatory -- This method must be implemented.*
[ "Removes", "the", "content", "data", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/repository/objects.py#L1405-L1417
ND-CSE-30151/tock
tock/run.py
run
def run(m, w, trace=False, steps=1000, show_stack=3): """Runs an automaton, automatically selecting a search method.""" # Check to see whether run_pda can handle it. is_pda = True stack = None if not m.oneway: is_pda = False for s in range(m.num_stores): if s == m.input: ...
python
def run(m, w, trace=False, steps=1000, show_stack=3): """Runs an automaton, automatically selecting a search method.""" # Check to see whether run_pda can handle it. is_pda = True stack = None if not m.oneway: is_pda = False for s in range(m.num_stores): if s == m.input: ...
[ "def", "run", "(", "m", ",", "w", ",", "trace", "=", "False", ",", "steps", "=", "1000", ",", "show_stack", "=", "3", ")", ":", "# Check to see whether run_pda can handle it.", "is_pda", "=", "True", "stack", "=", "None", "if", "not", "m", ".", "oneway",...
Runs an automaton, automatically selecting a search method.
[ "Runs", "an", "automaton", "automatically", "selecting", "a", "search", "method", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/run.py#L7-L33
ND-CSE-30151/tock
tock/run.py
run_bfs
def run_bfs(m, w, trace=False, steps=1000): """Runs an automaton using breadth-first search.""" from .machines import Store, Configuration, Transition agenda = collections.deque() chart = {} # Initial configuration config = list(m.start_config) w = Store(w) config[m.input] = w conf...
python
def run_bfs(m, w, trace=False, steps=1000): """Runs an automaton using breadth-first search.""" from .machines import Store, Configuration, Transition agenda = collections.deque() chart = {} # Initial configuration config = list(m.start_config) w = Store(w) config[m.input] = w conf...
[ "def", "run_bfs", "(", "m", ",", "w", ",", "trace", "=", "False", ",", "steps", "=", "1000", ")", ":", "from", ".", "machines", "import", "Store", ",", "Configuration", ",", "Transition", "agenda", "=", "collections", ".", "deque", "(", ")", "chart", ...
Runs an automaton using breadth-first search.
[ "Runs", "an", "automaton", "using", "breadth", "-", "first", "search", "." ]
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/run.py#L35-L95
ND-CSE-30151/tock
tock/run.py
run_pda
def run_pda(m, w, stack=2, trace=False, show_stack=3): """Runs a nondeterministic pushdown automaton using the cubic algorithm of: Bernard Lang, "Deterministic techniques for efficient non-deterministic parsers." doi:10.1007/3-540-06841-4_65 . `m`: the pushdown automaton `w`: the input string ...
python
def run_pda(m, w, stack=2, trace=False, show_stack=3): """Runs a nondeterministic pushdown automaton using the cubic algorithm of: Bernard Lang, "Deterministic techniques for efficient non-deterministic parsers." doi:10.1007/3-540-06841-4_65 . `m`: the pushdown automaton `w`: the input string ...
[ "def", "run_pda", "(", "m", ",", "w", ",", "stack", "=", "2", ",", "trace", "=", "False", ",", "show_stack", "=", "3", ")", ":", "\"\"\"The items are pairs of configurations (parent, child), where\n\n - parent is None and child's stack has no elided items\n - chil...
Runs a nondeterministic pushdown automaton using the cubic algorithm of: Bernard Lang, "Deterministic techniques for efficient non-deterministic parsers." doi:10.1007/3-540-06841-4_65 . `m`: the pushdown automaton `w`: the input string Store 1 is assumed to be the input, and store 2 is assumed to...
[ "Runs", "a", "nondeterministic", "pushdown", "automaton", "using", "the", "cubic", "algorithm", "of", ":", "Bernard", "Lang", "Deterministic", "techniques", "for", "efficient", "non", "-", "deterministic", "parsers", ".", "doi", ":", "10", ".", "1007", "/", "3...
train
https://github.com/ND-CSE-30151/tock/blob/b8d21901aaf0e6ac913c2afa855f5b5a882a16c6/tock/run.py#L97-L253
theosysbio/means
src/means/simulation/simulate.py
Simulation._append_zeros
def _append_zeros(self, initial_conditions, number_of_equations): """If not all intial conditions specified, append zeros to them TODO: is this really the best way to do this? """ if len(initial_conditions) < number_of_equations: initial_conditions = np.concatenate((initi...
python
def _append_zeros(self, initial_conditions, number_of_equations): """If not all intial conditions specified, append zeros to them TODO: is this really the best way to do this? """ if len(initial_conditions) < number_of_equations: initial_conditions = np.concatenate((initi...
[ "def", "_append_zeros", "(", "self", ",", "initial_conditions", ",", "number_of_equations", ")", ":", "if", "len", "(", "initial_conditions", ")", "<", "number_of_equations", ":", "initial_conditions", "=", "np", ".", "concatenate", "(", "(", "initial_conditions", ...
If not all intial conditions specified, append zeros to them TODO: is this really the best way to do this?
[ "If", "not", "all", "intial", "conditions", "specified", "append", "zeros", "to", "them", "TODO", ":", "is", "this", "really", "the", "best", "way", "to", "do", "this?" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/simulation/simulate.py#L122-L130
theosysbio/means
src/means/simulation/simulate.py
Simulation.simulate_system
def simulate_system(self, parameters, initial_conditions, timepoints): """ Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Mus...
python
def simulate_system(self, parameters, initial_conditions, timepoints): """ Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Mus...
[ "def", "simulate_system", "(", "self", ",", "parameters", ",", "initial_conditions", ",", "timepoints", ")", ":", "initial_conditions", "=", "self", ".", "_append_zeros", "(", "initial_conditions", ",", "self", ".", "problem", ".", "number_of_equations", ")", "sol...
Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Must be in the same order as in the model :param initial_conditions: List of the initi...
[ "Simulates", "the", "system", "for", "each", "of", "the", "timepoints", "starting", "at", "initial_constants", "and", "initial_values", "values" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/simulation/simulate.py#L166-L185
theosysbio/means
src/means/simulation/simulate.py
SimulationWithSensitivities.simulate_system
def simulate_system(self, parameters, initial_conditions, timepoints): """ Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Mus...
python
def simulate_system(self, parameters, initial_conditions, timepoints): """ Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Mus...
[ "def", "simulate_system", "(", "self", ",", "parameters", ",", "initial_conditions", ",", "timepoints", ")", ":", "return", "super", "(", "SimulationWithSensitivities", ",", "self", ")", ".", "simulate_system", "(", "parameters", ",", "initial_conditions", ",", "t...
Simulates the system for each of the timepoints, starting at initial_constants and initial_values values :param parameters: list of the initial values for the constants in the model. Must be in the same order as in the model :param initial_conditions: List of the initi...
[ "Simulates", "the", "system", "for", "each", "of", "the", "timepoints", "starting", "at", "initial_constants", "and", "initial_values", "values" ]
train
https://github.com/theosysbio/means/blob/fe164916a1d84ab2a4fa039871d38ccdf638b1db/src/means/simulation/simulate.py#L267-L281
delfick/harpoon
harpoon/dockerpty/pty.py
PseudoTerminal.start
def start(self, **kwargs): """ Present the PTY of the container inside the current process. This will take over the current process' TTY until the container's PTY is closed. """ pty_stdin, pty_stdout, pty_stderr = self.sockets() pumps = [] if pty_stdin ...
python
def start(self, **kwargs): """ Present the PTY of the container inside the current process. This will take over the current process' TTY until the container's PTY is closed. """ pty_stdin, pty_stdout, pty_stderr = self.sockets() pumps = [] if pty_stdin ...
[ "def", "start", "(", "self", ",", "*", "*", "kwargs", ")", ":", "pty_stdin", ",", "pty_stdout", ",", "pty_stderr", "=", "self", ".", "sockets", "(", ")", "pumps", "=", "[", "]", "if", "pty_stdin", "and", "self", ".", "interactive", ":", "pumps", ".",...
Present the PTY of the container inside the current process. This will take over the current process' TTY until the container's PTY is closed.
[ "Present", "the", "PTY", "of", "the", "container", "inside", "the", "current", "process", "." ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/dockerpty/pty.py#L126-L157
delfick/harpoon
harpoon/dockerpty/pty.py
PseudoTerminal.israw
def israw(self): """ Returns True if the PTY should operate in raw mode. If the container was not started with tty=True, this will return False. """ if self.raw is None: info = self.container_info() self.raw = self.stdout.isatty() and info['Config']['Tty...
python
def israw(self): """ Returns True if the PTY should operate in raw mode. If the container was not started with tty=True, this will return False. """ if self.raw is None: info = self.container_info() self.raw = self.stdout.isatty() and info['Config']['Tty...
[ "def", "israw", "(", "self", ")", ":", "if", "self", ".", "raw", "is", "None", ":", "info", "=", "self", ".", "container_info", "(", ")", "self", ".", "raw", "=", "self", ".", "stdout", ".", "isatty", "(", ")", "and", "info", "[", "'Config'", "]"...
Returns True if the PTY should operate in raw mode. If the container was not started with tty=True, this will return False.
[ "Returns", "True", "if", "the", "PTY", "should", "operate", "in", "raw", "mode", "." ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/dockerpty/pty.py#L160-L171
delfick/harpoon
harpoon/dockerpty/pty.py
PseudoTerminal.resize
def resize(self, size=None): """ Resize the container's PTY. If `size` is not None, it must be a tuple of (height,width), otherwise it will be determined by the size of the current TTY. """ if not self.israw(): return size = size or tty.size(self.st...
python
def resize(self, size=None): """ Resize the container's PTY. If `size` is not None, it must be a tuple of (height,width), otherwise it will be determined by the size of the current TTY. """ if not self.israw(): return size = size or tty.size(self.st...
[ "def", "resize", "(", "self", ",", "size", "=", "None", ")", ":", "if", "not", "self", ".", "israw", "(", ")", ":", "return", "size", "=", "size", "or", "tty", ".", "size", "(", "self", ".", "stdout", ")", "if", "size", "is", "not", "None", ":"...
Resize the container's PTY. If `size` is not None, it must be a tuple of (height,width), otherwise it will be determined by the size of the current TTY.
[ "Resize", "the", "container", "s", "PTY", "." ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/dockerpty/pty.py#L202-L220
mitsei/dlkit
dlkit/primordium/locale/types/currency_format.py
get_type_data
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'birdland.mit.edu', 'namespace': 'currency format', 'identifier': name, ...
python
def get_type_data(name): """Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type """ name = name.upper() try: return { 'authority': 'birdland.mit.edu', 'namespace': 'currency format', 'identifier': name, ...
[ "def", "get_type_data", "(", "name", ")", ":", "name", "=", "name", ".", "upper", "(", ")", "try", ":", "return", "{", "'authority'", ":", "'birdland.mit.edu'", ",", "'namespace'", ":", "'currency format'", ",", "'identifier'", ":", "name", ",", "'domain'", ...
Return dictionary representation of type. Can be used to initialize primordium.type.primitives.Type
[ "Return", "dictionary", "representation", "of", "type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/primordium/locale/types/currency_format.py#L15-L34
anuragkumarak95/wordnet
wordnet/tf_idf_generator.py
find_tf_idf
def find_tf_idf(file_names=['./../test/testdata'],prev_file_path=None, dump_path=None): '''Function to create a TF-IDF list of dictionaries for a corpus of docs. If you opt for dumping the data, you can provide a file_path with .tfidfpkl extension(standard made for better understanding) and also re-generate...
python
def find_tf_idf(file_names=['./../test/testdata'],prev_file_path=None, dump_path=None): '''Function to create a TF-IDF list of dictionaries for a corpus of docs. If you opt for dumping the data, you can provide a file_path with .tfidfpkl extension(standard made for better understanding) and also re-generate...
[ "def", "find_tf_idf", "(", "file_names", "=", "[", "'./../test/testdata'", "]", ",", "prev_file_path", "=", "None", ",", "dump_path", "=", "None", ")", ":", "tf_idf", "=", "[", "]", "# will hold a dict of word_count for every doc(line in a doc in this case)", "df", "=...
Function to create a TF-IDF list of dictionaries for a corpus of docs. If you opt for dumping the data, you can provide a file_path with .tfidfpkl extension(standard made for better understanding) and also re-generate a new tfidf list which overrides over an old one by mentioning its path. @Args: -- ...
[ "Function", "to", "create", "a", "TF", "-", "IDF", "list", "of", "dictionaries", "for", "a", "corpus", "of", "docs", ".", "If", "you", "opt", "for", "dumping", "the", "data", "you", "can", "provide", "a", "file_path", "with", ".", "tfidfpkl", "extension"...
train
https://github.com/anuragkumarak95/wordnet/blob/7aba239ddebb0971e9e76124890373b60a2573c8/wordnet/tf_idf_generator.py#L35-L89
anuragkumarak95/wordnet
wordnet/nn_words.py
find_knn
def find_knn(tf_idf,input_word,k=WIN,rand_on=True): '''func that find k nearest neighbors of a spcified word from a given file of tf-idf values of words for list of docs. @Args: -- tfidf_file_name : File name for the .tfidfpkl file to be used for searching. input_word : word for which process need t...
python
def find_knn(tf_idf,input_word,k=WIN,rand_on=True): '''func that find k nearest neighbors of a spcified word from a given file of tf-idf values of words for list of docs. @Args: -- tfidf_file_name : File name for the .tfidfpkl file to be used for searching. input_word : word for which process need t...
[ "def", "find_knn", "(", "tf_idf", ",", "input_word", ",", "k", "=", "WIN", ",", "rand_on", "=", "True", ")", ":", "#find docs that have input_word and gather their content", "word_bag", "=", "{", "}", "for", "doc", "in", "tf_idf", ":", "contains_flag", "=", "F...
func that find k nearest neighbors of a spcified word from a given file of tf-idf values of words for list of docs. @Args: -- tfidf_file_name : File name for the .tfidfpkl file to be used for searching. input_word : word for which process need to be done. k : amount of nearest neighbors to yield.(de...
[ "func", "that", "find", "k", "nearest", "neighbors", "of", "a", "spcified", "word", "from", "a", "given", "file", "of", "tf", "-", "idf", "values", "of", "words", "for", "list", "of", "docs", ".", "@Args", ":", "--", "tfidf_file_name", ":", "File", "na...
train
https://github.com/anuragkumarak95/wordnet/blob/7aba239ddebb0971e9e76124890373b60a2573c8/wordnet/nn_words.py#L18-L47
CodeLineFi/maclookup-python
src/maclookup/api_client.py
ApiClient.get
def get(self, mac): """Get data from API as instance of ResponseModel. Keyword arguments: mac -- MAC address or OUI for searching """ data = { self._FORMAT_F: 'json', self._SEARCH_F: mac } response = self.__decode_str(self.__call...
python
def get(self, mac): """Get data from API as instance of ResponseModel. Keyword arguments: mac -- MAC address or OUI for searching """ data = { self._FORMAT_F: 'json', self._SEARCH_F: mac } response = self.__decode_str(self.__call...
[ "def", "get", "(", "self", ",", "mac", ")", ":", "data", "=", "{", "self", ".", "_FORMAT_F", ":", "'json'", ",", "self", ".", "_SEARCH_F", ":", "mac", "}", "response", "=", "self", ".", "__decode_str", "(", "self", ".", "__call_api", "(", "self", "...
Get data from API as instance of ResponseModel. Keyword arguments: mac -- MAC address or OUI for searching
[ "Get", "data", "from", "API", "as", "instance", "of", "ResponseModel", "." ]
train
https://github.com/CodeLineFi/maclookup-python/blob/0d87dc6cb1a8c8583c9d242fbb3e98d70d83664f/src/maclookup/api_client.py#L32-L48
CodeLineFi/maclookup-python
src/maclookup/api_client.py
ApiClient.get_raw_data
def get_raw_data(self, mac, response_format='json'): """Get data from API as string. Keyword arguments: mac -- MAC address or OUI for searching response_format -- supported types you can see on the https://macaddress.io """ data = { self._FORMAT_...
python
def get_raw_data(self, mac, response_format='json'): """Get data from API as string. Keyword arguments: mac -- MAC address or OUI for searching response_format -- supported types you can see on the https://macaddress.io """ data = { self._FORMAT_...
[ "def", "get_raw_data", "(", "self", ",", "mac", ",", "response_format", "=", "'json'", ")", ":", "data", "=", "{", "self", ".", "_FORMAT_F", ":", "response_format", ",", "self", ".", "_SEARCH_F", ":", "mac", "}", "response", "=", "self", ".", "__decode_s...
Get data from API as string. Keyword arguments: mac -- MAC address or OUI for searching response_format -- supported types you can see on the https://macaddress.io
[ "Get", "data", "from", "API", "as", "string", "." ]
train
https://github.com/CodeLineFi/maclookup-python/blob/0d87dc6cb1a8c8583c9d242fbb3e98d70d83664f/src/maclookup/api_client.py#L50-L67
CodeLineFi/maclookup-python
src/maclookup/api_client.py
ApiClient.get_vendor
def get_vendor(self, mac): """Get vendor company name. Keyword arguments: mac -- MAC address or OUI for searching """ data = { self._SEARCH_F: mac, self._FORMAT_F: self._VERBOSE_T } response = self.__decode_str(self.__call_api(se...
python
def get_vendor(self, mac): """Get vendor company name. Keyword arguments: mac -- MAC address or OUI for searching """ data = { self._SEARCH_F: mac, self._FORMAT_F: self._VERBOSE_T } response = self.__decode_str(self.__call_api(se...
[ "def", "get_vendor", "(", "self", ",", "mac", ")", ":", "data", "=", "{", "self", ".", "_SEARCH_F", ":", "mac", ",", "self", ".", "_FORMAT_F", ":", "self", ".", "_VERBOSE_T", "}", "response", "=", "self", ".", "__decode_str", "(", "self", ".", "__cal...
Get vendor company name. Keyword arguments: mac -- MAC address or OUI for searching
[ "Get", "vendor", "company", "name", "." ]
train
https://github.com/CodeLineFi/maclookup-python/blob/0d87dc6cb1a8c8583c9d242fbb3e98d70d83664f/src/maclookup/api_client.py#L69-L83
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ProvenanceItemRecord.has_provenance
def has_provenance(self): """to handle deprecated mecqbank data""" if 'provenanceId' in self.my_osid_object._my_map: return bool(self.my_osid_object._my_map['provenanceId'] != '') else: return bool(self.my_osid_object._my_map['provenanceItemId'] != '')
python
def has_provenance(self): """to handle deprecated mecqbank data""" if 'provenanceId' in self.my_osid_object._my_map: return bool(self.my_osid_object._my_map['provenanceId'] != '') else: return bool(self.my_osid_object._my_map['provenanceItemId'] != '')
[ "def", "has_provenance", "(", "self", ")", ":", "if", "'provenanceId'", "in", "self", ".", "my_osid_object", ".", "_my_map", ":", "return", "bool", "(", "self", ".", "my_osid_object", ".", "_my_map", "[", "'provenanceId'", "]", "!=", "''", ")", "else", ":"...
to handle deprecated mecqbank data
[ "to", "handle", "deprecated", "mecqbank", "data" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L35-L40
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ProvenanceItemRecord.get_provenance_id
def get_provenance_id(self): """to handle deprecated mecqbank data""" if self.has_provenance(): if 'provenanceId' in self.my_osid_object._my_map: return self.my_osid_object._my_map['provenanceId'] else: return self.my_osid_object._my_map['provenanc...
python
def get_provenance_id(self): """to handle deprecated mecqbank data""" if self.has_provenance(): if 'provenanceId' in self.my_osid_object._my_map: return self.my_osid_object._my_map['provenanceId'] else: return self.my_osid_object._my_map['provenanc...
[ "def", "get_provenance_id", "(", "self", ")", ":", "if", "self", ".", "has_provenance", "(", ")", ":", "if", "'provenanceId'", "in", "self", ".", "my_osid_object", ".", "_my_map", ":", "return", "self", ".", "my_osid_object", ".", "_my_map", "[", "'provenanc...
to handle deprecated mecqbank data
[ "to", "handle", "deprecated", "mecqbank", "data" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L42-L49
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ProvenanceItemRecord.get_provenance_parent
def get_provenance_parent(self): """stub""" if self.has_provenance(): collection = JSONClientValidated('assessment', collection='Item', runtime=self.my_osid_object._runtime) result = collect...
python
def get_provenance_parent(self): """stub""" if self.has_provenance(): collection = JSONClientValidated('assessment', collection='Item', runtime=self.my_osid_object._runtime) result = collect...
[ "def", "get_provenance_parent", "(", "self", ")", ":", "if", "self", ".", "has_provenance", "(", ")", ":", "collection", "=", "JSONClientValidated", "(", "'assessment'", ",", "collection", "=", "'Item'", ",", "runtime", "=", "self", ".", "my_osid_object", ".",...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L51-L62
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ProvenanceItemRecord.get_provenance_children
def get_provenance_children(self): """stub""" if self.has_provenance_children(): collection = JSONClientValidated('assessment', collection='Item', runtime=self.my_osid_object._runtime) try: ...
python
def get_provenance_children(self): """stub""" if self.has_provenance_children(): collection = JSONClientValidated('assessment', collection='Item', runtime=self.my_osid_object._runtime) try: ...
[ "def", "get_provenance_children", "(", "self", ")", ":", "if", "self", ".", "has_provenance_children", "(", ")", ":", "collection", "=", "JSONClientValidated", "(", "'assessment'", ",", "collection", "=", "'Item'", ",", "runtime", "=", "self", ".", "my_osid_obje...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L77-L95
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ItemWithSolutionRecord.get_solution
def get_solution(self, parameters=None): """stub""" if not self.has_solution(): raise IllegalState() return DisplayText(self.my_osid_object._my_map['solution'])
python
def get_solution(self, parameters=None): """stub""" if not self.has_solution(): raise IllegalState() return DisplayText(self.my_osid_object._my_map['solution'])
[ "def", "get_solution", "(", "self", ",", "parameters", "=", "None", ")", ":", "if", "not", "self", ".", "has_solution", "(", ")", ":", "raise", "IllegalState", "(", ")", "return", "DisplayText", "(", "self", ".", "my_osid_object", ".", "_my_map", "[", "'...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L180-L184
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ItemWithSolutionFormRecord._init_metadata
def _init_metadata(self): """stub""" self._min_string_length = None self._max_string_length = None self._solution_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, ...
python
def _init_metadata(self): """stub""" self._min_string_length = None self._max_string_length = None self._solution_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, ...
[ "def", "_init_metadata", "(", "self", ")", ":", "self", ".", "_min_string_length", "=", "None", "self", ".", "_max_string_length", "=", "None", "self", ".", "_solution_metadata", "=", "{", "'element_id'", ":", "Id", "(", "self", ".", "my_osid_object_form", "."...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L203-L226
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ItemWithSolutionFormRecord.set_solution
def set_solution(self, text): """stub""" if not self.my_osid_object_form._is_valid_string( text, self.get_solution_metadata()): raise InvalidArgument('text') if is_string(text): self.my_osid_object_form._my_map['solution'] = { 'text': text,...
python
def set_solution(self, text): """stub""" if not self.my_osid_object_form._is_valid_string( text, self.get_solution_metadata()): raise InvalidArgument('text') if is_string(text): self.my_osid_object_form._my_map['solution'] = { 'text': text,...
[ "def", "set_solution", "(", "self", ",", "text", ")", ":", "if", "not", "self", ".", "my_osid_object_form", ".", "_is_valid_string", "(", "text", ",", "self", ".", "get_solution_metadata", "(", ")", ")", ":", "raise", "InvalidArgument", "(", "'text'", ")", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L232-L245
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
ItemWithSolutionFormRecord.clear_solution
def clear_solution(self): """stub""" if 'solution' not in self.my_osid_object_form._my_map: raise NotFound() self.my_osid_object_form._my_map['solution'] = \ dict(self._solution_metadata['default_string_values'][0])
python
def clear_solution(self): """stub""" if 'solution' not in self.my_osid_object_form._my_map: raise NotFound() self.my_osid_object_form._my_map['solution'] = \ dict(self._solution_metadata['default_string_values'][0])
[ "def", "clear_solution", "(", "self", ")", ":", "if", "'solution'", "not", "in", "self", ".", "my_osid_object_form", ".", "_my_map", ":", "raise", "NotFound", "(", ")", "self", ".", "my_osid_object_form", ".", "_my_map", "[", "'solution'", "]", "=", "dict", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L247-L252
mitsei/dlkit
dlkit/records/assessment/basic/base_records.py
MultiLanguageQuestionFormRecord.clear_texts
def clear_texts(self): """stub""" if self.get_texts_metadata().is_read_only(): raise NoAccess() self.my_osid_object_form._my_map['texts'] = \ self._texts_metadata['default_object_values'][0]
python
def clear_texts(self): """stub""" if self.get_texts_metadata().is_read_only(): raise NoAccess() self.my_osid_object_form._my_map['texts'] = \ self._texts_metadata['default_object_values'][0]
[ "def", "clear_texts", "(", "self", ")", ":", "if", "self", ".", "get_texts_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess", "(", ")", "self", ".", "my_osid_object_form", ".", "_my_map", "[", "'texts'", "]", "=", "self", ".", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/basic/base_records.py#L323-L328
mitsei/dlkit
dlkit/handcar/utilities.py
BankHierarchyUrls.children
def children(self, alias, bank_id): """ URL for getting or setting child relationships for the specified bank :param alias: :param bank_id: :return: """ return self._root + self._safe_alias(alias) + '/child/ids/' + str(bank_id)
python
def children(self, alias, bank_id): """ URL for getting or setting child relationships for the specified bank :param alias: :param bank_id: :return: """ return self._root + self._safe_alias(alias) + '/child/ids/' + str(bank_id)
[ "def", "children", "(", "self", ",", "alias", ",", "bank_id", ")", ":", "return", "self", ".", "_root", "+", "self", ".", "_safe_alias", "(", "alias", ")", "+", "'/child/ids/'", "+", "str", "(", "bank_id", ")" ]
URL for getting or setting child relationships for the specified bank :param alias: :param bank_id: :return:
[ "URL", "for", "getting", "or", "setting", "child", "relationships", "for", "the", "specified", "bank", ":", "param", "alias", ":", ":", "param", "bank_id", ":", ":", "return", ":" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/utilities.py#L47-L54
mitsei/dlkit
dlkit/handcar/utilities.py
BankHierarchyUrls.hierarchy
def hierarchy(self, alias=None): """ return the URL for the bank hierarchy itself :param alias: :return: """ if alias: return self._root + self._safe_alias(alias) else: return self._root
python
def hierarchy(self, alias=None): """ return the URL for the bank hierarchy itself :param alias: :return: """ if alias: return self._root + self._safe_alias(alias) else: return self._root
[ "def", "hierarchy", "(", "self", ",", "alias", "=", "None", ")", ":", "if", "alias", ":", "return", "self", ".", "_root", "+", "self", ".", "_safe_alias", "(", "alias", ")", "else", ":", "return", "self", ".", "_root" ]
return the URL for the bank hierarchy itself :param alias: :return:
[ "return", "the", "URL", "for", "the", "bank", "hierarchy", "itself", ":", "param", "alias", ":", ":", "return", ":" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/utilities.py#L56-L65
mitsei/dlkit
dlkit/handcar/utilities.py
BankHierarchyUrls.nodes
def nodes(self, alias, depth=10, bank_id=None): """ URL for getting bulk nodes in hierarchy :param alias: :param depth: :return: """ if bank_id: return self._root + self._safe_alias(alias) + '/child/nodes/' + bank_id + '?descendentlevels=' + str(depth)...
python
def nodes(self, alias, depth=10, bank_id=None): """ URL for getting bulk nodes in hierarchy :param alias: :param depth: :return: """ if bank_id: return self._root + self._safe_alias(alias) + '/child/nodes/' + bank_id + '?descendentlevels=' + str(depth)...
[ "def", "nodes", "(", "self", ",", "alias", ",", "depth", "=", "10", ",", "bank_id", "=", "None", ")", ":", "if", "bank_id", ":", "return", "self", ".", "_root", "+", "self", ".", "_safe_alias", "(", "alias", ")", "+", "'/child/nodes/'", "+", "bank_id...
URL for getting bulk nodes in hierarchy :param alias: :param depth: :return:
[ "URL", "for", "getting", "bulk", "nodes", "in", "hierarchy", ":", "param", "alias", ":", ":", "param", "depth", ":", ":", "return", ":" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/utilities.py#L67-L77
mitsei/dlkit
dlkit/handcar/utilities.py
BankHierarchyUrls.parents
def parents(self, alias, bank_id): """ URL for getting or setting parent relationships for the specified bank :param alias: :param bank_id: :return: """ return self._root + self._safe_alias(alias) + '/parent/ids/' + bank_id
python
def parents(self, alias, bank_id): """ URL for getting or setting parent relationships for the specified bank :param alias: :param bank_id: :return: """ return self._root + self._safe_alias(alias) + '/parent/ids/' + bank_id
[ "def", "parents", "(", "self", ",", "alias", ",", "bank_id", ")", ":", "return", "self", ".", "_root", "+", "self", ".", "_safe_alias", "(", "alias", ")", "+", "'/parent/ids/'", "+", "bank_id" ]
URL for getting or setting parent relationships for the specified bank :param alias: :param bank_id: :return:
[ "URL", "for", "getting", "or", "setting", "parent", "relationships", "for", "the", "specified", "bank", ":", "param", "alias", ":", ":", "param", "bank_id", ":", ":", "return", ":" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/utilities.py#L79-L86
cloudnull/cloudlib
cloudlib/shell.py
ShellCommands.run_command
def run_command(self, command, shell=True, env=None, execute='/bin/bash', return_code=None): """Run a shell command. The options available: * ``shell`` to be enabled or disabled, which provides the ability to execute arbitrary stings or not. if disabled co...
python
def run_command(self, command, shell=True, env=None, execute='/bin/bash', return_code=None): """Run a shell command. The options available: * ``shell`` to be enabled or disabled, which provides the ability to execute arbitrary stings or not. if disabled co...
[ "def", "run_command", "(", "self", ",", "command", ",", "shell", "=", "True", ",", "env", "=", "None", ",", "execute", "=", "'/bin/bash'", ",", "return_code", "=", "None", ")", ":", "self", ".", "log", ".", "info", "(", "'Command: [ %s ]'", ",", "comma...
Run a shell command. The options available: * ``shell`` to be enabled or disabled, which provides the ability to execute arbitrary stings or not. if disabled commands must be in the format of a ``list`` * ``env`` is an environment override and or manipulati...
[ "Run", "a", "shell", "command", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/shell.py#L36-L93
cloudnull/cloudlib
cloudlib/shell.py
ShellCommands.mkdir_p
def mkdir_p(self, path): """Python implementation of `mkdir -p <path>` :param path: ``str`` """ try: if not os.path.isdir(path): os.makedirs(path) self.log.info('Created Directory [ %s ]', path) except OSError as exc: if ex...
python
def mkdir_p(self, path): """Python implementation of `mkdir -p <path>` :param path: ``str`` """ try: if not os.path.isdir(path): os.makedirs(path) self.log.info('Created Directory [ %s ]', path) except OSError as exc: if ex...
[ "def", "mkdir_p", "(", "self", ",", "path", ")", ":", "try", ":", "if", "not", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "os", ".", "makedirs", "(", "path", ")", "self", ".", "log", ".", "info", "(", "'Created Directory [ %s ]'", ",",...
Python implementation of `mkdir -p <path>` :param path: ``str``
[ "Python", "implementation", "of", "mkdir", "-", "p", "<path", ">" ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/shell.py#L95-L110
cloudnull/cloudlib
cloudlib/shell.py
ShellCommands.write_file
def write_file(self, filename, content): """Write a file. This is useful when writing a file that will fit within memory :param filename: ``str`` :param content: ``str`` """ with open(filename, 'wb') as f: self.log.debug(content) f.write(content)
python
def write_file(self, filename, content): """Write a file. This is useful when writing a file that will fit within memory :param filename: ``str`` :param content: ``str`` """ with open(filename, 'wb') as f: self.log.debug(content) f.write(content)
[ "def", "write_file", "(", "self", ",", "filename", ",", "content", ")", ":", "with", "open", "(", "filename", ",", "'wb'", ")", "as", "f", ":", "self", ".", "log", ".", "debug", "(", "content", ")", "f", ".", "write", "(", "content", ")" ]
Write a file. This is useful when writing a file that will fit within memory :param filename: ``str`` :param content: ``str``
[ "Write", "a", "file", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/shell.py#L112-L122
cloudnull/cloudlib
cloudlib/shell.py
ShellCommands.write_file_lines
def write_file_lines(self, filename, contents): """Write a file. This is useful when writing a file that may not fit within memory. :param filename: ``str`` :param contents: ``list`` """ with open(filename, 'wb') as f: self.log.debug(contents) f....
python
def write_file_lines(self, filename, contents): """Write a file. This is useful when writing a file that may not fit within memory. :param filename: ``str`` :param contents: ``list`` """ with open(filename, 'wb') as f: self.log.debug(contents) f....
[ "def", "write_file_lines", "(", "self", ",", "filename", ",", "contents", ")", ":", "with", "open", "(", "filename", ",", "'wb'", ")", "as", "f", ":", "self", ".", "log", ".", "debug", "(", "contents", ")", "f", ".", "writelines", "(", "contents", ")...
Write a file. This is useful when writing a file that may not fit within memory. :param filename: ``str`` :param contents: ``list``
[ "Write", "a", "file", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/shell.py#L124-L134
cloudnull/cloudlib
cloudlib/shell.py
ShellCommands.md5_checker
def md5_checker(self, md5sum, local_file=None, file_object=None): """Return True if the local file and the provided `md5sum` are equal. If the processed file and the provided md5sum do not match an exception is raised indicating the failure. :param md5sum: ``str`` :param local_...
python
def md5_checker(self, md5sum, local_file=None, file_object=None): """Return True if the local file and the provided `md5sum` are equal. If the processed file and the provided md5sum do not match an exception is raised indicating the failure. :param md5sum: ``str`` :param local_...
[ "def", "md5_checker", "(", "self", ",", "md5sum", ",", "local_file", "=", "None", ",", "file_object", "=", "None", ")", ":", "def", "calc_hash", "(", ")", ":", "\"\"\"Read the hash.\n\n :return data_hash.read():\n \"\"\"", "return", "file_object", ...
Return True if the local file and the provided `md5sum` are equal. If the processed file and the provided md5sum do not match an exception is raised indicating the failure. :param md5sum: ``str`` :param local_file: ``str`` :param file_object: ``BytesIO`` :return: ``bol`...
[ "Return", "True", "if", "the", "local", "file", "and", "the", "provided", "md5sum", "are", "equal", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/shell.py#L167-L216
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
generate_signature
def generate_signature(secret, verb, url, nonce, data): """Generate a request signature compatible with BitMEX.""" # Parse the url so we can remove the base and extract just the path. parsedURL = urllib.parse.urlparse(url) path = parsedURL.path if parsedURL.query: path = path + '?' + parsedU...
python
def generate_signature(secret, verb, url, nonce, data): """Generate a request signature compatible with BitMEX.""" # Parse the url so we can remove the base and extract just the path. parsedURL = urllib.parse.urlparse(url) path = parsedURL.path if parsedURL.query: path = path + '?' + parsedU...
[ "def", "generate_signature", "(", "secret", ",", "verb", ",", "url", ",", "nonce", ",", "data", ")", ":", "# Parse the url so we can remove the base and extract just the path.", "parsedURL", "=", "urllib", ".", "parse", ".", "urlparse", "(", "url", ")", "path", "=...
Generate a request signature compatible with BitMEX.
[ "Generate", "a", "request", "signature", "compatible", "with", "BitMEX", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L31-L45
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.get_ticker
def get_ticker(self): '''Return a ticker object. Generated from quote and trade.''' lastQuote = self.data['quote'][-1] lastTrade = self.data['trade'][-1] ticker = { "last": lastTrade['price'], "buy": lastQuote['bidPrice'], "sell": lastQuote['askPrice']...
python
def get_ticker(self): '''Return a ticker object. Generated from quote and trade.''' lastQuote = self.data['quote'][-1] lastTrade = self.data['trade'][-1] ticker = { "last": lastTrade['price'], "buy": lastQuote['bidPrice'], "sell": lastQuote['askPrice']...
[ "def", "get_ticker", "(", "self", ")", ":", "lastQuote", "=", "self", ".", "data", "[", "'quote'", "]", "[", "-", "1", "]", "lastTrade", "=", "self", ".", "data", "[", "'trade'", "]", "[", "-", "1", "]", "ticker", "=", "{", "\"last\"", ":", "last...
Return a ticker object. Generated from quote and trade.
[ "Return", "a", "ticker", "object", ".", "Generated", "from", "quote", "and", "trade", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L92-L105
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.__connect
def __connect(self, wsURL, symbol): '''Connect to the websocket in a thread.''' self.logger.debug("Starting thread") self.ws = websocket.WebSocketApp(wsURL, on_message=self.__on_message, on_close=self.__on_close, ...
python
def __connect(self, wsURL, symbol): '''Connect to the websocket in a thread.''' self.logger.debug("Starting thread") self.ws = websocket.WebSocketApp(wsURL, on_message=self.__on_message, on_close=self.__on_close, ...
[ "def", "__connect", "(", "self", ",", "wsURL", ",", "symbol", ")", ":", "self", ".", "logger", ".", "debug", "(", "\"Starting thread\"", ")", "self", ".", "ws", "=", "websocket", ".", "WebSocketApp", "(", "wsURL", ",", "on_message", "=", "self", ".", "...
Connect to the websocket in a thread.
[ "Connect", "to", "the", "websocket", "in", "a", "thread", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L121-L146
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.__get_auth
def __get_auth(self): '''Return auth headers. Will use API Keys if present in settings.''' if self.api_key == None and self.login == None: self.logger.error("No authentication provided! Unable to connect.") sys.exit(1) if self.api_key == None: self.logger.inf...
python
def __get_auth(self): '''Return auth headers. Will use API Keys if present in settings.''' if self.api_key == None and self.login == None: self.logger.error("No authentication provided! Unable to connect.") sys.exit(1) if self.api_key == None: self.logger.inf...
[ "def", "__get_auth", "(", "self", ")", ":", "if", "self", ".", "api_key", "==", "None", "and", "self", ".", "login", "==", "None", ":", "self", ".", "logger", ".", "error", "(", "\"No authentication provided! Unable to connect.\"", ")", "sys", ".", "exit", ...
Return auth headers. Will use API Keys if present in settings.
[ "Return", "auth", "headers", ".", "Will", "use", "API", "Keys", "if", "present", "in", "settings", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L148-L169
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.__push_symbol
def __push_symbol(self, symbol): '''Ask the websocket for a symbol push. Gets instrument, orderBook, quote, and trade''' self.__send_command("getSymbol", symbol) while not {'instrument', 'trade', 'orderBook25'} <= set(self.data): sleep(0.1)
python
def __push_symbol(self, symbol): '''Ask the websocket for a symbol push. Gets instrument, orderBook, quote, and trade''' self.__send_command("getSymbol", symbol) while not {'instrument', 'trade', 'orderBook25'} <= set(self.data): sleep(0.1)
[ "def", "__push_symbol", "(", "self", ",", "symbol", ")", ":", "self", ".", "__send_command", "(", "\"getSymbol\"", ",", "symbol", ")", "while", "not", "{", "'instrument'", ",", "'trade'", ",", "'orderBook25'", "}", "<=", "set", "(", "self", ".", "data", ...
Ask the websocket for a symbol push. Gets instrument, orderBook, quote, and trade
[ "Ask", "the", "websocket", "for", "a", "symbol", "push", ".", "Gets", "instrument", "orderBook", "quote", "and", "trade" ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L186-L190
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.__send_command
def __send_command(self, command, args=[]): '''Send a raw command.''' self.ws.send(json.dumps({"op": command, "args": args}))
python
def __send_command(self, command, args=[]): '''Send a raw command.''' self.ws.send(json.dumps({"op": command, "args": args}))
[ "def", "__send_command", "(", "self", ",", "command", ",", "args", "=", "[", "]", ")", ":", "self", ".", "ws", ".", "send", "(", "json", ".", "dumps", "(", "{", "\"op\"", ":", "command", ",", "\"args\"", ":", "args", "}", ")", ")" ]
Send a raw command.
[ "Send", "a", "raw", "command", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L192-L194
joequant/cryptoexchange
cryptoexchange/bitmex_ws.py
BitMEXWebsocket.__on_message
def __on_message(self, ws, message): '''Handler for parsing WS messages.''' message = json.loads(message) self.logger.debug(json.dumps(message)) table = message['table'] if 'table' in message else None action = message['action'] if 'action' in message else None try: ...
python
def __on_message(self, ws, message): '''Handler for parsing WS messages.''' message = json.loads(message) self.logger.debug(json.dumps(message)) table = message['table'] if 'table' in message else None action = message['action'] if 'action' in message else None try: ...
[ "def", "__on_message", "(", "self", ",", "ws", ",", "message", ")", ":", "message", "=", "json", ".", "loads", "(", "message", ")", "self", ".", "logger", ".", "debug", "(", "json", ".", "dumps", "(", "message", ")", ")", "table", "=", "message", "...
Handler for parsing WS messages.
[ "Handler", "for", "parsing", "WS", "messages", "." ]
train
https://github.com/joequant/cryptoexchange/blob/6690fbd9a2ba00e40d7484425808c84d44233f0c/cryptoexchange/bitmex_ws.py#L196-L245
wise-team/python-social-auth-steemconnect
steemconnect/backends.py
SteemConnectOAuth2.get_user_details
def get_user_details(self, response): """Return user details from GitHub account""" account = response['account'] metadata = json.loads(account.get('json_metadata') or '{}') account['json_metadata'] = metadata return { 'id': account['id'], 'username': ac...
python
def get_user_details(self, response): """Return user details from GitHub account""" account = response['account'] metadata = json.loads(account.get('json_metadata') or '{}') account['json_metadata'] = metadata return { 'id': account['id'], 'username': ac...
[ "def", "get_user_details", "(", "self", ",", "response", ")", ":", "account", "=", "response", "[", "'account'", "]", "metadata", "=", "json", ".", "loads", "(", "account", ".", "get", "(", "'json_metadata'", ")", "or", "'{}'", ")", "account", "[", "'jso...
Return user details from GitHub account
[ "Return", "user", "details", "from", "GitHub", "account" ]
train
https://github.com/wise-team/python-social-auth-steemconnect/blob/087299895bceab587b30740c38fce8d5dbecddb7/steemconnect/backends.py#L41-L53
wise-team/python-social-auth-steemconnect
steemconnect/backends.py
SteemConnectOAuth2.user_data
def user_data(self, access_token, *args, **kwargs): """Loads user data from service""" return self.get_json(self.USER_INFO_URL, method="POST", headers=self._get_headers(access_token))
python
def user_data(self, access_token, *args, **kwargs): """Loads user data from service""" return self.get_json(self.USER_INFO_URL, method="POST", headers=self._get_headers(access_token))
[ "def", "user_data", "(", "self", ",", "access_token", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "self", ".", "get_json", "(", "self", ".", "USER_INFO_URL", ",", "method", "=", "\"POST\"", ",", "headers", "=", "self", ".", "_get_hea...
Loads user data from service
[ "Loads", "user", "data", "from", "service" ]
train
https://github.com/wise-team/python-social-auth-steemconnect/blob/087299895bceab587b30740c38fce8d5dbecddb7/steemconnect/backends.py#L55-L58
ilgarm/pyzimbra
pyzimbra/soap_auth.py
SoapAuthenticator.authenticate_admin
def authenticate_admin(self, transport, account_name, password): """ Authenticates administrator using username and password. """ Authenticator.authenticate_admin(self, transport, account_name, password) auth_token = AuthToken() auth_token.account_name = account_name ...
python
def authenticate_admin(self, transport, account_name, password): """ Authenticates administrator using username and password. """ Authenticator.authenticate_admin(self, transport, account_name, password) auth_token = AuthToken() auth_token.account_name = account_name ...
[ "def", "authenticate_admin", "(", "self", ",", "transport", ",", "account_name", ",", "password", ")", ":", "Authenticator", ".", "authenticate_admin", "(", "self", ",", "transport", ",", "account_name", ",", "password", ")", "auth_token", "=", "AuthToken", "(",...
Authenticates administrator using username and password.
[ "Authenticates", "administrator", "using", "username", "and", "password", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/soap_auth.py#L50-L77
ilgarm/pyzimbra
pyzimbra/soap_auth.py
SoapAuthenticator.authenticate
def authenticate(self, transport, account_name, password=None): """ Authenticates account using soap method. """ Authenticator.authenticate(self, transport, account_name, password) if password == None: return self.pre_auth(transport, account_name) else: ...
python
def authenticate(self, transport, account_name, password=None): """ Authenticates account using soap method. """ Authenticator.authenticate(self, transport, account_name, password) if password == None: return self.pre_auth(transport, account_name) else: ...
[ "def", "authenticate", "(", "self", ",", "transport", ",", "account_name", ",", "password", "=", "None", ")", ":", "Authenticator", ".", "authenticate", "(", "self", ",", "transport", ",", "account_name", ",", "password", ")", "if", "password", "==", "None",...
Authenticates account using soap method.
[ "Authenticates", "account", "using", "soap", "method", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/soap_auth.py#L80-L89
ilgarm/pyzimbra
pyzimbra/soap_auth.py
SoapAuthenticator.auth
def auth(self, transport, account_name, password): """ Authenticates using username and password. """ auth_token = AuthToken() auth_token.account_name = account_name attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=account_name, a...
python
def auth(self, transport, account_name, password): """ Authenticates using username and password. """ auth_token = AuthToken() auth_token.account_name = account_name attrs = {sconstant.A_BY: sconstant.V_NAME} account = SOAPpy.Types.stringType(data=account_name, a...
[ "def", "auth", "(", "self", ",", "transport", ",", "account_name", ",", "password", ")", ":", "auth_token", "=", "AuthToken", "(", ")", "auth_token", ".", "account_name", "=", "account_name", "attrs", "=", "{", "sconstant", ".", "A_BY", ":", "sconstant", "...
Authenticates using username and password.
[ "Authenticates", "using", "username", "and", "password", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/soap_auth.py#L92-L122
ilgarm/pyzimbra
pyzimbra/soap_auth.py
SoapAuthenticator.pre_auth
def pre_auth(self, transport, account_name): """ Authenticates using username and domain key. """ auth_token = AuthToken() auth_token.account_name = account_name domain = util.get_domain(account_name) if domain == None: raise AuthException('Invalid au...
python
def pre_auth(self, transport, account_name): """ Authenticates using username and domain key. """ auth_token = AuthToken() auth_token.account_name = account_name domain = util.get_domain(account_name) if domain == None: raise AuthException('Invalid au...
[ "def", "pre_auth", "(", "self", ",", "transport", ",", "account_name", ")", ":", "auth_token", "=", "AuthToken", "(", ")", "auth_token", ".", "account_name", "=", "account_name", "domain", "=", "util", ".", "get_domain", "(", "account_name", ")", "if", "doma...
Authenticates using username and domain key.
[ "Authenticates", "using", "username", "and", "domain", "key", "." ]
train
https://github.com/ilgarm/pyzimbra/blob/c397bc7497554d260ec6fd1a80405aed872a70cc/pyzimbra/soap_auth.py#L125-L180
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PDFPreviewRecord.has_preview
def has_preview(self): """stub""" # I had to add the following check because file record types don't seem to be implemented # correctly for raw edx Question objects if ('fileIds' not in self.my_osid_object._my_map or 'preview' not in self.my_osid_object._my_map['fileIds']...
python
def has_preview(self): """stub""" # I had to add the following check because file record types don't seem to be implemented # correctly for raw edx Question objects if ('fileIds' not in self.my_osid_object._my_map or 'preview' not in self.my_osid_object._my_map['fileIds']...
[ "def", "has_preview", "(", "self", ")", ":", "# I had to add the following check because file record types don't seem to be implemented", "# correctly for raw edx Question objects", "if", "(", "'fileIds'", "not", "in", "self", ".", "my_osid_object", ".", "_my_map", "or", "'prev...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L59-L67
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PDFPreviewFormRecord._init_metadata
def _init_metadata(self): """stub""" super(PDFPreviewFormRecord, self)._init_metadata() self._preview_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'file'), ...
python
def _init_metadata(self): """stub""" super(PDFPreviewFormRecord, self)._init_metadata() self._preview_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'file'), ...
[ "def", "_init_metadata", "(", "self", ")", ":", "super", "(", "PDFPreviewFormRecord", ",", "self", ")", ".", "_init_metadata", "(", ")", "self", ".", "_preview_metadata", "=", "{", "'element_id'", ":", "Id", "(", "self", ".", "my_osid_object_form", ".", "_au...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L103-L119
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PDFPreviewFormRecord.add_preview
def add_preview(self, preview_data, file_name): """stub""" label = 'preview' asset_type = PDF_PREVIEW_ASSET_TYPE asset_content_type = PDF_ASSET_CONTENT_GENUS_TYPE self.add_file(preview_data, label=label, asset_type=asset_type, ...
python
def add_preview(self, preview_data, file_name): """stub""" label = 'preview' asset_type = PDF_PREVIEW_ASSET_TYPE asset_content_type = PDF_ASSET_CONTENT_GENUS_TYPE self.add_file(preview_data, label=label, asset_type=asset_type, ...
[ "def", "add_preview", "(", "self", ",", "preview_data", ",", "file_name", ")", ":", "label", "=", "'preview'", "asset_type", "=", "PDF_PREVIEW_ASSET_TYPE", "asset_content_type", "=", "PDF_ASSET_CONTENT_GENUS_TYPE", "self", ".", "add_file", "(", "preview_data", ",", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L125-L135
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PDFPreviewFormRecord.clear_preview
def clear_preview(self): """stub""" try: rm = self.my_osid_object._get_provider_manager('REPOSITORY') except AttributeError: rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') try: aas = rm.get_asset_admin_session_for_repository( ...
python
def clear_preview(self): """stub""" try: rm = self.my_osid_object._get_provider_manager('REPOSITORY') except AttributeError: rm = self.my_osid_object_form._get_provider_manager('REPOSITORY') try: aas = rm.get_asset_admin_session_for_repository( ...
[ "def", "clear_preview", "(", "self", ")", ":", "try", ":", "rm", "=", "self", ".", "my_osid_object", ".", "_get_provider_manager", "(", "'REPOSITORY'", ")", "except", "AttributeError", ":", "rm", "=", "self", ".", "my_osid_object_form", ".", "_get_provider_manag...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L137-L154
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SimpleDifficultyItemFormRecord._init_map
def _init_map(self): """stub""" super(SimpleDifficultyItemFormRecord, self)._init_map() self.my_osid_object_form._my_map['texts']['difficulty'] = \ self._difficulty_metadata['default_string_values'][0]
python
def _init_map(self): """stub""" super(SimpleDifficultyItemFormRecord, self)._init_map() self.my_osid_object_form._my_map['texts']['difficulty'] = \ self._difficulty_metadata['default_string_values'][0]
[ "def", "_init_map", "(", "self", ")", ":", "super", "(", "SimpleDifficultyItemFormRecord", ",", "self", ")", ".", "_init_map", "(", ")", "self", ".", "my_osid_object_form", ".", "_my_map", "[", "'texts'", "]", "[", "'difficulty'", "]", "=", "self", ".", "_...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L193-L197
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SimpleDifficultyItemFormRecord._init_metadata
def _init_metadata(self): """stub""" super(SimpleDifficultyItemFormRecord, self)._init_metadata() self._min_string_length = None self._max_string_length = None self._difficulty_metadata = { 'element_id': Id(self.my_osid_object_form._authority, ...
python
def _init_metadata(self): """stub""" super(SimpleDifficultyItemFormRecord, self)._init_metadata() self._min_string_length = None self._max_string_length = None self._difficulty_metadata = { 'element_id': Id(self.my_osid_object_form._authority, ...
[ "def", "_init_metadata", "(", "self", ")", ":", "super", "(", "SimpleDifficultyItemFormRecord", ",", "self", ")", ".", "_init_metadata", "(", ")", "self", ".", "_min_string_length", "=", "None", "self", ".", "_max_string_length", "=", "None", "self", ".", "_di...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L199-L224
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SimpleDifficultyItemFormRecord.set_difficulty
def set_difficulty(self, difficulty): """stub""" if not is_string(difficulty): raise InvalidArgument('difficulty value must be a string') if difficulty.lower() not in ['low', 'medium', 'hard']: raise InvalidArgument('difficulty value must be low, medium, or hard') ...
python
def set_difficulty(self, difficulty): """stub""" if not is_string(difficulty): raise InvalidArgument('difficulty value must be a string') if difficulty.lower() not in ['low', 'medium', 'hard']: raise InvalidArgument('difficulty value must be low, medium, or hard') ...
[ "def", "set_difficulty", "(", "self", ",", "difficulty", ")", ":", "if", "not", "is_string", "(", "difficulty", ")", ":", "raise", "InvalidArgument", "(", "'difficulty value must be a string'", ")", "if", "difficulty", ".", "lower", "(", ")", "not", "in", "[",...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L230-L236
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SimpleDifficultyItemFormRecord.clear_difficulty
def clear_difficulty(self): """stub""" if (self.get_difficulty_metadata().is_read_only() or self.get_difficulty_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['texts']['difficulty'] = \ self._difficulty_metadata['default_strin...
python
def clear_difficulty(self): """stub""" if (self.get_difficulty_metadata().is_read_only() or self.get_difficulty_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['texts']['difficulty'] = \ self._difficulty_metadata['default_strin...
[ "def", "clear_difficulty", "(", "self", ")", ":", "if", "(", "self", ".", "get_difficulty_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_difficulty_metadata", "(", ")", ".", "is_required", "(", ")", ")", ":", "raise", "NoAccess...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L238-L244
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SimpleDifficultyItemQueryRecord.match_difficulty
def match_difficulty(self, value): """stub""" self._my_osid_query._add_match('texts.difficulty', str(value).lower(), True)
python
def match_difficulty(self, value): """stub""" self._my_osid_query._add_match('texts.difficulty', str(value).lower(), True)
[ "def", "match_difficulty", "(", "self", ",", "value", ")", ":", "self", ".", "_my_osid_query", ".", "_add_match", "(", "'texts.difficulty'", ",", "str", "(", "value", ")", ".", "lower", "(", ")", ",", "True", ")" ]
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L249-L251
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SourceItemFormRecord._init_map
def _init_map(self): """stub""" super(SourceItemFormRecord, self)._init_map() self.my_osid_object_form._my_map['texts']['source'] = \ self._source_metadata['default_string_values'][0]
python
def _init_map(self): """stub""" super(SourceItemFormRecord, self)._init_map() self.my_osid_object_form._my_map['texts']['source'] = \ self._source_metadata['default_string_values'][0]
[ "def", "_init_map", "(", "self", ")", ":", "super", "(", "SourceItemFormRecord", ",", "self", ")", ".", "_init_map", "(", ")", "self", ".", "my_osid_object_form", ".", "_my_map", "[", "'texts'", "]", "[", "'source'", "]", "=", "self", ".", "_source_metadat...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L294-L298
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SourceItemFormRecord._init_metadata
def _init_metadata(self): """stub""" super(SourceItemFormRecord, self)._init_metadata() self._min_string_length = None self._max_string_length = None self._source_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_o...
python
def _init_metadata(self): """stub""" super(SourceItemFormRecord, self)._init_metadata() self._min_string_length = None self._max_string_length = None self._source_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_o...
[ "def", "_init_metadata", "(", "self", ")", ":", "super", "(", "SourceItemFormRecord", ",", "self", ")", ".", "_init_metadata", "(", ")", "self", ".", "_min_string_length", "=", "None", "self", ".", "_max_string_length", "=", "None", "self", ".", "_source_metad...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L300-L325
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SourceItemFormRecord.set_source
def set_source(self, source): """stub""" if not is_string(source): raise InvalidArgument('source value must be a string') self.my_osid_object_form._my_map['texts']['source']['text'] = source
python
def set_source(self, source): """stub""" if not is_string(source): raise InvalidArgument('source value must be a string') self.my_osid_object_form._my_map['texts']['source']['text'] = source
[ "def", "set_source", "(", "self", ",", "source", ")", ":", "if", "not", "is_string", "(", "source", ")", ":", "raise", "InvalidArgument", "(", "'source value must be a string'", ")", "self", ".", "my_osid_object_form", ".", "_my_map", "[", "'texts'", "]", "[",...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L331-L335
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
SourceItemFormRecord.clear_source
def clear_source(self): """stub""" if (self.get_source_metadata().is_read_only() or self.get_source_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['texts']['source'] = \ self._source_metadata['default_string_values'][0]
python
def clear_source(self): """stub""" if (self.get_source_metadata().is_read_only() or self.get_source_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['texts']['source'] = \ self._source_metadata['default_string_values'][0]
[ "def", "clear_source", "(", "self", ")", ":", "if", "(", "self", ".", "get_source_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_source_metadata", "(", ")", ".", "is_required", "(", ")", ")", ":", "raise", "NoAccess", "(", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L337-L343
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PublishedRecord.is_published
def is_published(self): """stub""" if 'published' not in self.my_osid_object._my_map: return False return bool(self.my_osid_object._my_map['published'])
python
def is_published(self): """stub""" if 'published' not in self.my_osid_object._my_map: return False return bool(self.my_osid_object._my_map['published'])
[ "def", "is_published", "(", "self", ")", ":", "if", "'published'", "not", "in", "self", ".", "my_osid_object", ".", "_my_map", ":", "return", "False", "return", "bool", "(", "self", ".", "my_osid_object", ".", "_my_map", "[", "'published'", "]", ")" ]
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L364-L368
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PublishedFormRecord._init_metadata
def _init_metadata(self): """stub""" self._published_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'published'), 'element_label': 'Published', 'instruct...
python
def _init_metadata(self): """stub""" self._published_metadata = { 'element_id': Id(self.my_osid_object_form._authority, self.my_osid_object_form._namespace, 'published'), 'element_label': 'Published', 'instruct...
[ "def", "_init_metadata", "(", "self", ")", ":", "self", ".", "_published_metadata", "=", "{", "'element_id'", ":", "Id", "(", "self", ".", "my_osid_object_form", ".", "_authority", ",", "self", ".", "my_osid_object_form", ".", "_namespace", ",", "'published'", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L392-L406
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PublishedFormRecord.set_published
def set_published(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_published_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_boolean(value): raise InvalidArgument() self.my_o...
python
def set_published(self, value=None): """stub""" if value is None: raise NullArgument() if self.get_published_metadata().is_read_only(): raise NoAccess() if not self.my_osid_object_form._is_valid_boolean(value): raise InvalidArgument() self.my_o...
[ "def", "set_published", "(", "self", ",", "value", "=", "None", ")", ":", "if", "value", "is", "None", ":", "raise", "NullArgument", "(", ")", "if", "self", ".", "get_published_metadata", "(", ")", ".", "is_read_only", "(", ")", ":", "raise", "NoAccess",...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L412-L420
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
PublishedFormRecord.clear_published
def clear_published(self): """stub""" if (self.get_published_metadata().is_read_only() or self.get_published_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['published'] = \ self._published_metadata['default_published_values'][...
python
def clear_published(self): """stub""" if (self.get_published_metadata().is_read_only() or self.get_published_metadata().is_required()): raise NoAccess() self.my_osid_object_form._my_map['published'] = \ self._published_metadata['default_published_values'][...
[ "def", "clear_published", "(", "self", ")", ":", "if", "(", "self", ".", "get_published_metadata", "(", ")", ".", "is_read_only", "(", ")", "or", "self", ".", "get_published_metadata", "(", ")", ".", "is_required", "(", ")", ")", ":", "raise", "NoAccess", ...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L422-L428
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
MecQBankBaseMixin._init_map
def _init_map(self): """stub""" SimpleDifficultyItemFormRecord._init_map(self) SourceItemFormRecord._init_map(self) PDFPreviewFormRecord._init_map(self) PublishedFormRecord._init_map(self) ProvenanceFormRecord._init_map(self) super(MecQBankBaseMixin, self)._init_m...
python
def _init_map(self): """stub""" SimpleDifficultyItemFormRecord._init_map(self) SourceItemFormRecord._init_map(self) PDFPreviewFormRecord._init_map(self) PublishedFormRecord._init_map(self) ProvenanceFormRecord._init_map(self) super(MecQBankBaseMixin, self)._init_m...
[ "def", "_init_map", "(", "self", ")", ":", "SimpleDifficultyItemFormRecord", ".", "_init_map", "(", "self", ")", "SourceItemFormRecord", ".", "_init_map", "(", "self", ")", "PDFPreviewFormRecord", ".", "_init_map", "(", "self", ")", "PublishedFormRecord", ".", "_i...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L440-L447
mitsei/dlkit
dlkit/records/assessment/mecqbank/mecqbank_base_records.py
MecQBankBaseMixin._init_metadata
def _init_metadata(self): """stub""" SimpleDifficultyItemFormRecord._init_metadata(self) SourceItemFormRecord._init_metadata(self) PDFPreviewFormRecord._init_metadata(self) PublishedFormRecord._init_metadata(self) ProvenanceFormRecord._init_metadata(self) super(Me...
python
def _init_metadata(self): """stub""" SimpleDifficultyItemFormRecord._init_metadata(self) SourceItemFormRecord._init_metadata(self) PDFPreviewFormRecord._init_metadata(self) PublishedFormRecord._init_metadata(self) ProvenanceFormRecord._init_metadata(self) super(Me...
[ "def", "_init_metadata", "(", "self", ")", ":", "SimpleDifficultyItemFormRecord", ".", "_init_metadata", "(", "self", ")", "SourceItemFormRecord", ".", "_init_metadata", "(", "self", ")", "PDFPreviewFormRecord", ".", "_init_metadata", "(", "self", ")", "PublishedFormR...
stub
[ "stub" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/mecqbank/mecqbank_base_records.py#L449-L456
delfick/harpoon
docs/sphinx/ext/show_specs.py
ShowSpecsDirective.run
def run(self): """For each file in noseOfYeti/specs, output nodes to represent each spec file""" tokens = [] for name, spec in (("Harpoon", HarpoonSpec().harpoon_spec), ("Image", HarpoonSpec().image_spec)): section = nodes.section() section['names'].append(name) ...
python
def run(self): """For each file in noseOfYeti/specs, output nodes to represent each spec file""" tokens = [] for name, spec in (("Harpoon", HarpoonSpec().harpoon_spec), ("Image", HarpoonSpec().image_spec)): section = nodes.section() section['names'].append(name) ...
[ "def", "run", "(", "self", ")", ":", "tokens", "=", "[", "]", "for", "name", ",", "spec", "in", "(", "(", "\"Harpoon\"", ",", "HarpoonSpec", "(", ")", ".", "harpoon_spec", ")", ",", "(", "\"Image\"", ",", "HarpoonSpec", "(", ")", ".", "image_spec", ...
For each file in noseOfYeti/specs, output nodes to represent each spec file
[ "For", "each", "file", "in", "noseOfYeti", "/", "specs", "output", "nodes", "to", "represent", "each", "spec", "file" ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/docs/sphinx/ext/show_specs.py#L15-L30