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
delfick/harpoon
docs/sphinx/ext/show_specs.py
ShowSpecsDirective.nodes_for_spec
def nodes_for_spec(self, spec): """ Determine nodes for an input_algorithms spec Taking into account nested specs """ tokens = [] if isinstance(spec, sb.create_spec): container = nodes.container(classes=["option_spec_option shortline blue-back"]) ...
python
def nodes_for_spec(self, spec): """ Determine nodes for an input_algorithms spec Taking into account nested specs """ tokens = [] if isinstance(spec, sb.create_spec): container = nodes.container(classes=["option_spec_option shortline blue-back"]) ...
[ "def", "nodes_for_spec", "(", "self", ",", "spec", ")", ":", "tokens", "=", "[", "]", "if", "isinstance", "(", "spec", ",", "sb", ".", "create_spec", ")", ":", "container", "=", "nodes", ".", "container", "(", "classes", "=", "[", "\"option_spec_option s...
Determine nodes for an input_algorithms spec Taking into account nested specs
[ "Determine", "nodes", "for", "an", "input_algorithms", "spec", "Taking", "into", "account", "nested", "specs" ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/docs/sphinx/ext/show_specs.py#L97-L137
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingManager.get_log_entry_admin_session_for_log
def get_log_entry_admin_session_for_log(self, log_id): """Gets the ``OsidSession`` associated with the log entry administrative service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSessio...
python
def get_log_entry_admin_session_for_log(self, log_id): """Gets the ``OsidSession`` associated with the log entry administrative service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSessio...
[ "def", "get_log_entry_admin_session_for_log", "(", "self", ",", "log_id", ")", ":", "if", "not", "self", ".", "supports_log_entry_admin", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the catalog Id is found othe...
Gets the ``OsidSession`` associated with the log entry administrative service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSession`` raise: NotFound - no ``Log`` found by the given ``Id`...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "entry", "administrative", "service", "for", "the", "given", "log", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L443-L465
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_logging_session
def get_logging_session(self, proxy): """Gets the ``OsidSession`` associated with the logging service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - un...
python
def get_logging_session(self, proxy): """Gets the ``OsidSession`` associated with the logging service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - un...
[ "def", "get_logging_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_logging", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LoggingSession", "(", ...
Gets the ``OsidSession`` associated with the logging service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete request raise: Unimplem...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "logging", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L640-L655
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_logging_session_for_log
def get_logging_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the logging service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSe...
python
def get_logging_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the logging service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSe...
[ "def", "get_logging_session_for_log", "(", "self", ",", "log_id", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_logging", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the catalog Id is found ot...
Gets the ``OsidSession`` associated with the logging service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LoggingSession) - a ``LoggingSession`` raise: NotFound - no ``Log`` found by the given ...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "logging", "service", "for", "the", "given", "log", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L658-L680
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_lookup_session
def get_log_entry_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the logging reading service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSession) - a ``LogEntryLookupSession`` raise: NullArgument - ``proxy`` i...
python
def get_log_entry_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the logging reading service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSession) - a ``LogEntryLookupSession`` raise: NullArgument - ``proxy`` i...
[ "def", "get_log_entry_lookup_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogEntry...
Gets the ``OsidSession`` associated with the logging reading service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSession) - a ``LogEntryLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to com...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "logging", "reading", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L683-L700
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_lookup_session_for_log
def get_log_entry_lookup_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the log reading service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSess...
python
def get_log_entry_lookup_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the log reading service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSess...
[ "def", "get_log_entry_lookup_session_for_log", "(", "self", ",", "log_id", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the cata...
Gets the ``OsidSession`` associated with the log reading service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLookupSession) - a ``LogEntryLookupSession`` raise: NotFoun...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "reading", "service", "for", "the", "given", "log", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L703-L726
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_query_session
def get_log_entry_query_session(self, proxy): """Gets the ``OsidSession`` associated with the logging entry query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySession) - a ``LogEntryQuerySession`` raise: NullArgument - ``proxy`` ...
python
def get_log_entry_query_session(self, proxy): """Gets the ``OsidSession`` associated with the logging entry query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySession) - a ``LogEntryQuerySession`` raise: NullArgument - ``proxy`` ...
[ "def", "get_log_entry_query_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_query", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogEntryQu...
Gets the ``OsidSession`` associated with the logging entry query service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySession) - a ``LogEntryQuerySession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to c...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "logging", "entry", "query", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L729-L746
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_query_session_for_log
def get_log_entry_query_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the log entry query service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySe...
python
def get_log_entry_query_session_for_log(self, log_id, proxy): """Gets the ``OsidSession`` associated with the log entry query service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySe...
[ "def", "get_log_entry_query_session_for_log", "(", "self", ",", "log_id", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_query", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "##", "# Also include check to see if the catalo...
Gets the ``OsidSession`` associated with the log entry query service for the given log. arg: log_id (osid.id.Id): the ``Id`` of the ``Log`` arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryQuerySession) - a ``LogEntryQuerySession`` raise: NotFo...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "entry", "query", "service", "for", "the", "given", "log", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L749-L772
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_admin_session
def get_log_entry_admin_session(self, proxy): """Gets the ``OsidSession`` associated with the logging entry administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSession`` raise: NullArgument - `...
python
def get_log_entry_admin_session(self, proxy): """Gets the ``OsidSession`` associated with the logging entry administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSession`` raise: NullArgument - `...
[ "def", "get_log_entry_admin_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_admin", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogEntryAd...
Gets the ``OsidSession`` associated with the logging entry administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryAdminSession) - a ``LogEntryAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - un...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "logging", "entry", "administrative", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L775-L792
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_log_session
def get_log_entry_log_session(self, proxy): """Gets the session for retrieving log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogSession) - a ``LogEntryLogSession`` raise: NullArgument - ``proxy`` is ``null`` r...
python
def get_log_entry_log_session(self, proxy): """Gets the session for retrieving log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogSession) - a ``LogEntryLogSession`` raise: NullArgument - ``proxy`` is ``null`` r...
[ "def", "get_log_entry_log_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_log", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogEntryLogSes...
Gets the session for retrieving log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogSession) - a ``LogEntryLogSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Gets", "the", "session", "for", "retrieving", "log", "entry", "to", "log", "mappings", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L821-L838
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_entry_log_assignment_session
def get_log_entry_log_assignment_session(self, proxy): """Gets the session for assigning log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogAssignmentSession) - a ``LogEntryLogAssignmentSession`` raise: NullArgument - `...
python
def get_log_entry_log_assignment_session(self, proxy): """Gets the session for assigning log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogAssignmentSession) - a ``LogEntryLogAssignmentSession`` raise: NullArgument - `...
[ "def", "get_log_entry_log_assignment_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_entry_log_assignment", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ...
Gets the session for assigning log entry to log mappings. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogEntryLogAssignmentSession) - a ``LogEntryLogAssignmentSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to c...
[ "Gets", "the", "session", "for", "assigning", "log", "entry", "to", "log", "mappings", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L841-L858
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_lookup_session
def get_log_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the log lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogLookupSession) - a ``LogLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationF...
python
def get_log_lookup_session(self, proxy): """Gets the ``OsidSession`` associated with the log lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogLookupSession) - a ``LogLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationF...
[ "def", "get_log_lookup_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_lookup", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogLookupSession", ...
Gets the ``OsidSession`` associated with the log lookup service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogLookupSession) - a ``LogLookupSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete request raise: U...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "lookup", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L861-L876
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_admin_session
def get_log_admin_session(self, proxy): """Gets the ``OsidSession`` associated with the log administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogAdminSession) - a ``LogAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: Opera...
python
def get_log_admin_session(self, proxy): """Gets the ``OsidSession`` associated with the log administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogAdminSession) - a ``LogAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: Opera...
[ "def", "get_log_admin_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_admin", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogAdminSession", "(...
Gets the ``OsidSession`` associated with the log administrative service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogAdminSession) - a ``LogAdminSession`` raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to complete request rai...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "administrative", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L879-L894
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_hierarchy_session
def get_log_hierarchy_session(self, proxy): """Gets the ``OsidSession`` associated with the log hierarchy service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchySession) - a ``LogHierarchySession`` for logs raise: NullArgument - ``proxy`` i...
python
def get_log_hierarchy_session(self, proxy): """Gets the ``OsidSession`` associated with the log hierarchy service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchySession) - a ``LogHierarchySession`` for logs raise: NullArgument - ``proxy`` i...
[ "def", "get_log_hierarchy_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_hierarchy", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "LogHierarchySe...
Gets the ``OsidSession`` associated with the log hierarchy service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchySession) - a ``LogHierarchySession`` for logs raise: NullArgument - ``proxy`` is ``null`` raise: OperationFailed - unable to ...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "hierarchy", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L897-L914
mitsei/dlkit
dlkit/json_/logging_/managers.py
LoggingProxyManager.get_log_hierarchy_design_session
def get_log_hierarchy_design_session(self, proxy): """Gets the ``OsidSession`` associated with the log hierarchy design service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchyDesignSession) - a ``HierarchyDesignSession`` for logs raise: Nul...
python
def get_log_hierarchy_design_session(self, proxy): """Gets the ``OsidSession`` associated with the log hierarchy design service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchyDesignSession) - a ``HierarchyDesignSession`` for logs raise: Nul...
[ "def", "get_log_hierarchy_design_session", "(", "self", ",", "proxy", ")", ":", "if", "not", "self", ".", "supports_log_hierarchy_design", "(", ")", ":", "raise", "errors", ".", "Unimplemented", "(", ")", "# pylint: disable=no-member", "return", "sessions", ".", "...
Gets the ``OsidSession`` associated with the log hierarchy design service. arg: proxy (osid.proxy.Proxy): a proxy return: (osid.logging.LogHierarchyDesignSession) - a ``HierarchyDesignSession`` for logs raise: NullArgument - ``proxy`` is ``null`` raise: OperationFai...
[ "Gets", "the", "OsidSession", "associated", "with", "the", "log", "hierarchy", "design", "service", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/logging_/managers.py#L917-L934
cloudnull/cloudlib
cloudlib/arguments.py
ArgumentParserator._add_opt_argument
def _add_opt_argument(self, opt_args, arg_parser): """Add an argument to an instantiated parser. :param opt_args: ``dict`` :param arg_parser: ``object`` """ option_args = opt_args.copy() groups = option_args.pop('groups', None) if groups: self._add_g...
python
def _add_opt_argument(self, opt_args, arg_parser): """Add an argument to an instantiated parser. :param opt_args: ``dict`` :param arg_parser: ``object`` """ option_args = opt_args.copy() groups = option_args.pop('groups', None) if groups: self._add_g...
[ "def", "_add_opt_argument", "(", "self", ",", "opt_args", ",", "arg_parser", ")", ":", "option_args", "=", "opt_args", ".", "copy", "(", ")", "groups", "=", "option_args", ".", "pop", "(", "'groups'", ",", "None", ")", "if", "groups", ":", "self", ".", ...
Add an argument to an instantiated parser. :param opt_args: ``dict`` :param arg_parser: ``object``
[ "Add", "an", "argument", "to", "an", "instantiated", "parser", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/arguments.py#L188-L213
cloudnull/cloudlib
cloudlib/arguments.py
ArgumentParserator._setup_parser
def _setup_parser(self): """Setup a configuration parser. Contains built in ``--system-config`` || ``-SC`` variable which is used to allow a user to set arguments in a configuration file which would then be processed from the "default" section of the provided file, assuming the ...
python
def _setup_parser(self): """Setup a configuration parser. Contains built in ``--system-config`` || ``-SC`` variable which is used to allow a user to set arguments in a configuration file which would then be processed from the "default" section of the provided file, assuming the ...
[ "def", "_setup_parser", "(", "self", ")", ":", "# Set the prefix for environment variables", "ename", "=", "self", ".", "env_name", ".", "upper", "(", ")", "env_name", "=", "'%s_CONFIG'", "%", "ename", "# Accept a config file", "conf_parser", "=", "argparse", ".", ...
Setup a configuration parser. Contains built in ``--system-config`` || ``-SC`` variable which is used to allow a user to set arguments in a configuration file which would then be processed from the "default" section of the provided file, assuming the file exists. :return: ``tup...
[ "Setup", "a", "configuration", "parser", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/arguments.py#L215-L268
cloudnull/cloudlib
cloudlib/arguments.py
ArgumentParserator.arg_parser
def arg_parser(self, passed_args=None): """Setup argument Parsing. If preset args are to be specified use the ``passed_args`` tuple. :param passed_args: ``list`` :return: ``dict`` """ parser, subpar, remaining_argv = self._setup_parser() if not isinstance(passed...
python
def arg_parser(self, passed_args=None): """Setup argument Parsing. If preset args are to be specified use the ``passed_args`` tuple. :param passed_args: ``list`` :return: ``dict`` """ parser, subpar, remaining_argv = self._setup_parser() if not isinstance(passed...
[ "def", "arg_parser", "(", "self", ",", "passed_args", "=", "None", ")", ":", "parser", ",", "subpar", ",", "remaining_argv", "=", "self", ".", "_setup_parser", "(", ")", "if", "not", "isinstance", "(", "passed_args", ",", "list", ")", ":", "passed_args", ...
Setup argument Parsing. If preset args are to be specified use the ``passed_args`` tuple. :param passed_args: ``list`` :return: ``dict``
[ "Setup", "argument", "Parsing", "." ]
train
https://github.com/cloudnull/cloudlib/blob/5038111ce02521caa2558117e3bae9e1e806d315/cloudlib/arguments.py#L270-L326
delfick/harpoon
harpoon/dockerpty/__init__.py
start
def start(client, container, interactive=True, stdout=None, stderr=None, stdin=None, **kwargs): """ Present the PTY of the container inside the current process. This is just a wrapper for PseudoTerminal(client, container).start() """ PseudoTerminal(client, container, interactive=interactive, stdou...
python
def start(client, container, interactive=True, stdout=None, stderr=None, stdin=None, **kwargs): """ Present the PTY of the container inside the current process. This is just a wrapper for PseudoTerminal(client, container).start() """ PseudoTerminal(client, container, interactive=interactive, stdou...
[ "def", "start", "(", "client", ",", "container", ",", "interactive", "=", "True", ",", "stdout", "=", "None", ",", "stderr", "=", "None", ",", "stdin", "=", "None", ",", "*", "*", "kwargs", ")", ":", "PseudoTerminal", "(", "client", ",", "container", ...
Present the PTY of the container inside the current process. This is just a wrapper for PseudoTerminal(client, container).start()
[ "Present", "the", "PTY", "of", "the", "container", "inside", "the", "current", "process", "." ]
train
https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/dockerpty/__init__.py#L20-L27
siemens/django-mantis-openioc-importer
mantis_openioc_importer/importer.py
OpenIOC_Import.xml_import
def xml_import(self, filepath=None, xml_content=None, markings=None, identifier_ns_uri=None, initialize_importer=True, **kwargs): """ Import an OpenIOC indicator xml (root element 'ioc') fro...
python
def xml_import(self, filepath=None, xml_content=None, markings=None, identifier_ns_uri=None, initialize_importer=True, **kwargs): """ Import an OpenIOC indicator xml (root element 'ioc') fro...
[ "def", "xml_import", "(", "self", ",", "filepath", "=", "None", ",", "xml_content", "=", "None", ",", "markings", "=", "None", ",", "identifier_ns_uri", "=", "None", ",", "initialize_importer", "=", "True", ",", "*", "*", "kwargs", ")", ":", "if", "initi...
Import an OpenIOC indicator xml (root element 'ioc') from file <filepath> or from a string <xml_content> You can provide: - a list of markings with which all generated Information Objects will be associated (e.g., in order to provide provenance function) - The uri of a name...
[ "Import", "an", "OpenIOC", "indicator", "xml", "(", "root", "element", "ioc", ")", "from", "file", "<filepath", ">", "or", "from", "a", "string", "<xml_content", ">" ]
train
https://github.com/siemens/django-mantis-openioc-importer/blob/db244201d0e307f25535a753ee0c3adf78ab5d34/mantis_openioc_importer/importer.py#L123-L257
siemens/django-mantis-openioc-importer
mantis_openioc_importer/importer.py
OpenIOC_Import.id_and_revision_extractor
def id_and_revision_extractor(self,xml_elt): """ Function for determing an identifier (and, where applicable, timestamp/revision information) for extracted embedded content; to be used for DINGO's xml-import hook 'id_and_revision_extractor'. This function is called - fo...
python
def id_and_revision_extractor(self,xml_elt): """ Function for determing an identifier (and, where applicable, timestamp/revision information) for extracted embedded content; to be used for DINGO's xml-import hook 'id_and_revision_extractor'. This function is called - fo...
[ "def", "id_and_revision_extractor", "(", "self", ",", "xml_elt", ")", ":", "result", "=", "{", "'id'", ":", "None", ",", "'timestamp'", ":", "None", "}", "attributes", "=", "extract_attributes", "(", "xml_elt", ",", "prefix_key_char", "=", "'@'", ")", "# Ext...
Function for determing an identifier (and, where applicable, timestamp/revision information) for extracted embedded content; to be used for DINGO's xml-import hook 'id_and_revision_extractor'. This function is called - for the top-level node of the XML to be imported. - for ea...
[ "Function", "for", "determing", "an", "identifier", "(", "and", "where", "applicable", "timestamp", "/", "revision", "information", ")", "for", "extracted", "embedded", "content", ";", "to", "be", "used", "for", "DINGO", "s", "xml", "-", "import", "hook", "i...
train
https://github.com/siemens/django-mantis-openioc-importer/blob/db244201d0e307f25535a753ee0c3adf78ab5d34/mantis_openioc_importer/importer.py#L270-L330
siemens/django-mantis-openioc-importer
mantis_openioc_importer/importer.py
OpenIOC_Import.openioc_embedding_pred
def openioc_embedding_pred(self,parent, child, ns_mapping): """ Predicate for recognizing inlined content in an XML; to be used for DINGO's xml-import hook 'embedded_predicate'. The question this predicate must answer is whether the child should be extracted into a separate objec...
python
def openioc_embedding_pred(self,parent, child, ns_mapping): """ Predicate for recognizing inlined content in an XML; to be used for DINGO's xml-import hook 'embedded_predicate'. The question this predicate must answer is whether the child should be extracted into a separate objec...
[ "def", "openioc_embedding_pred", "(", "self", ",", "parent", ",", "child", ",", "ns_mapping", ")", ":", "# For openIOC, we extract the Indicator-Item elements,", "# since those correspond to observables.", "child_attributes", "=", "extract_attributes", "(", "child", ",", "pre...
Predicate for recognizing inlined content in an XML; to be used for DINGO's xml-import hook 'embedded_predicate'. The question this predicate must answer is whether the child should be extracted into a separate object. The function returns either - False (the child is not to be ...
[ "Predicate", "for", "recognizing", "inlined", "content", "in", "an", "XML", ";", "to", "be", "used", "for", "DINGO", "s", "xml", "-", "import", "hook", "embedded_predicate", ".", "The", "question", "this", "predicate", "must", "answer", "is", "whether", "the...
train
https://github.com/siemens/django-mantis-openioc-importer/blob/db244201d0e307f25535a753ee0c3adf78ab5d34/mantis_openioc_importer/importer.py#L333-L406
siemens/django-mantis-openioc-importer
mantis_openioc_importer/importer.py
OpenIOC_Import.transformer
def transformer(self,elt_name,contents): """ The OpenIOC indicator contains the actual observable bits of an indicator in the following form:: <IndicatorItem id="b9ef2559-cc59-4463-81d9-52800545e16e" condition="contains"> <Context document="FileItem" search="Fil...
python
def transformer(self,elt_name,contents): """ The OpenIOC indicator contains the actual observable bits of an indicator in the following form:: <IndicatorItem id="b9ef2559-cc59-4463-81d9-52800545e16e" condition="contains"> <Context document="FileItem" search="Fil...
[ "def", "transformer", "(", "self", ",", "elt_name", ",", "contents", ")", ":", "# If the current element is not an IndicatorItem, we do nothing", "if", "elt_name", "!=", "'IndicatorItem'", ":", "return", "(", "elt_name", ",", "contents", ")", "else", ":", "# We have a...
The OpenIOC indicator contains the actual observable bits of an indicator in the following form:: <IndicatorItem id="b9ef2559-cc59-4463-81d9-52800545e16e" condition="contains"> <Context document="FileItem" search="FileItem/PEInfo/Sections/Section/Name" type="mir"/> ...
[ "The", "OpenIOC", "indicator", "contains", "the", "actual", "observable", "bits", "of", "an", "indicator", "in", "the", "following", "form", "::" ]
train
https://github.com/siemens/django-mantis-openioc-importer/blob/db244201d0e307f25535a753ee0c3adf78ab5d34/mantis_openioc_importer/importer.py#L408-L489
siemens/django-mantis-openioc-importer
mantis_openioc_importer/importer.py
OpenIOC_Import.reference_handler
def reference_handler(self,iobject, fact, attr_info, add_fact_kargs): """ Handler for facts that contain a reference to a fact. See below in the comment regarding the fact_handler_list for a description of the signature of handler functions. As shown below in the handler list, t...
python
def reference_handler(self,iobject, fact, attr_info, add_fact_kargs): """ Handler for facts that contain a reference to a fact. See below in the comment regarding the fact_handler_list for a description of the signature of handler functions. As shown below in the handler list, t...
[ "def", "reference_handler", "(", "self", ",", "iobject", ",", "fact", ",", "attr_info", ",", "add_fact_kargs", ")", ":", "(", "namespace_uri", ",", "uid", ")", "=", "(", "self", ".", "identifier_ns_uri", ",", "attr_info", "[", "'idref'", "]", ")", "# We ar...
Handler for facts that contain a reference to a fact. See below in the comment regarding the fact_handler_list for a description of the signature of handler functions. As shown below in the handler list, this handler is called when a attribute with key '@idref' on the fact's node ...
[ "Handler", "for", "facts", "that", "contain", "a", "reference", "to", "a", "fact", ".", "See", "below", "in", "the", "comment", "regarding", "the", "fact_handler_list", "for", "a", "description", "of", "the", "signature", "of", "handler", "functions", "." ]
train
https://github.com/siemens/django-mantis-openioc-importer/blob/db244201d0e307f25535a753ee0c3adf78ab5d34/mantis_openioc_importer/importer.py#L566-L609
OpenAgInitiative/openag_python
openag/utils.py
synthesize_firmware_module_info
def synthesize_firmware_module_info(modules, module_types): """ Modules are allowed to define attributes on their inputs and outputs that override the values defined in their respective module types. This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models...
python
def synthesize_firmware_module_info(modules, module_types): """ Modules are allowed to define attributes on their inputs and outputs that override the values defined in their respective module types. This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models...
[ "def", "synthesize_firmware_module_info", "(", "modules", ",", "module_types", ")", ":", "res", "=", "{", "}", "for", "mod_id", ",", "mod_info", "in", "modules", ".", "items", "(", ")", ":", "mod_info", "=", "dict", "(", "mod_info", ")", "mod_type", "=", ...
Modules are allowed to define attributes on their inputs and outputs that override the values defined in their respective module types. This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models.FirmwareModule` objects) and a dictionary of `module_types` (mappin...
[ "Modules", "are", "allowed", "to", "define", "attributes", "on", "their", "inputs", "and", "outputs", "that", "override", "the", "values", "defined", "in", "their", "respective", "module", "types", ".", "This", "function", "takes", "as", "input", "a", "diction...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L6-L68
OpenAgInitiative/openag_python
openag/utils.py
synthesize_software_module_info
def synthesize_software_module_info(modules, module_types): """ This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models.SoftwareModule` objects) and a dictionary of `module_types` (mapping module type IDs to :class:`~openag.models.FirmwareModuleType` obje...
python
def synthesize_software_module_info(modules, module_types): """ This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models.SoftwareModule` objects) and a dictionary of `module_types` (mapping module type IDs to :class:`~openag.models.FirmwareModuleType` obje...
[ "def", "synthesize_software_module_info", "(", "modules", ",", "module_types", ")", ":", "res", "=", "{", "}", "for", "mod_id", ",", "mod_info", "in", "modules", ".", "items", "(", ")", ":", "mod_info", "=", "dict", "(", "mod_info", ")", "mod_type", "=", ...
This function takes as input a dictionary of `modules` (mapping module IDs to :class:`~openag.models.SoftwareModule` objects) and a dictionary of `module_types` (mapping module type IDs to :class:`~openag.models.FirmwareModuleType` objects). For each module, it synthesizes the information in that module...
[ "This", "function", "takes", "as", "input", "a", "dictionary", "of", "modules", "(", "mapping", "module", "IDs", "to", ":", "class", ":", "~openag", ".", "models", ".", "SoftwareModule", "objects", ")", "and", "a", "dictionary", "of", "module_types", "(", ...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L70-L105
OpenAgInitiative/openag_python
openag/utils.py
process_args
def process_args(mod_id, args, type_args): """ Takes as input a list of arguments defined on a module and the information about the required arguments defined on the corresponding module type. Validates that the number of supplied arguments is valid and fills any missing arguments with their default...
python
def process_args(mod_id, args, type_args): """ Takes as input a list of arguments defined on a module and the information about the required arguments defined on the corresponding module type. Validates that the number of supplied arguments is valid and fills any missing arguments with their default...
[ "def", "process_args", "(", "mod_id", ",", "args", ",", "type_args", ")", ":", "res", "=", "list", "(", "args", ")", "if", "len", "(", "args", ")", ">", "len", "(", "type_args", ")", ":", "raise", "ValueError", "(", "'Too many arguments specified for modul...
Takes as input a list of arguments defined on a module and the information about the required arguments defined on the corresponding module type. Validates that the number of supplied arguments is valid and fills any missing arguments with their default values from the module type
[ "Takes", "as", "input", "a", "list", "of", "arguments", "defined", "on", "a", "module", "and", "the", "information", "about", "the", "required", "arguments", "defined", "on", "the", "corresponding", "module", "type", ".", "Validates", "that", "the", "number", ...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L107-L131
OpenAgInitiative/openag_python
openag/utils.py
process_params
def process_params(mod_id, params, type_params): """ Takes as input a dictionary of parameters defined on a module and the information about the required parameters defined on the corresponding module type. Validatates that are required parameters were supplied and fills any missing parameters with ...
python
def process_params(mod_id, params, type_params): """ Takes as input a dictionary of parameters defined on a module and the information about the required parameters defined on the corresponding module type. Validatates that are required parameters were supplied and fills any missing parameters with ...
[ "def", "process_params", "(", "mod_id", ",", "params", ",", "type_params", ")", ":", "res", "=", "{", "}", "for", "param_name", ",", "param_info", "in", "type_params", ".", "items", "(", ")", ":", "val", "=", "params", ".", "get", "(", "param_name", ",...
Takes as input a dictionary of parameters defined on a module and the information about the required parameters defined on the corresponding module type. Validatates that are required parameters were supplied and fills any missing parameters with their default values from the module type. Returns a nest...
[ "Takes", "as", "input", "a", "dictionary", "of", "parameters", "defined", "on", "a", "module", "and", "the", "information", "about", "the", "required", "parameters", "defined", "on", "the", "corresponding", "module", "type", ".", "Validatates", "that", "are", ...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L133-L156
OpenAgInitiative/openag_python
openag/utils.py
dedupe_by
def dedupe_by(things, key=None): """ Given an iterator of things and an optional key generation function, return a new iterator of deduped things. Things are compared and de-duped by the key function, which is hash() by default. """ if not key: key = hash index = {key(thing): thing f...
python
def dedupe_by(things, key=None): """ Given an iterator of things and an optional key generation function, return a new iterator of deduped things. Things are compared and de-duped by the key function, which is hash() by default. """ if not key: key = hash index = {key(thing): thing f...
[ "def", "dedupe_by", "(", "things", ",", "key", "=", "None", ")", ":", "if", "not", "key", ":", "key", "=", "hash", "index", "=", "{", "key", "(", "thing", ")", ":", "thing", "for", "thing", "in", "things", "}", "return", "index", ".", "values", "...
Given an iterator of things and an optional key generation function, return a new iterator of deduped things. Things are compared and de-duped by the key function, which is hash() by default.
[ "Given", "an", "iterator", "of", "things", "and", "an", "optional", "key", "generation", "function", "return", "a", "new", "iterator", "of", "deduped", "things", ".", "Things", "are", "compared", "and", "de", "-", "duped", "by", "the", "key", "function", "...
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L163-L172
OpenAgInitiative/openag_python
openag/utils.py
make_dir_name_from_url
def make_dir_name_from_url(url): """This function attempts to emulate something like Git's "humanish" directory naming for clone. It's probably not a perfect facimile, but it's close.""" url_path = urlparse(url).path head, tail = os.path.split(url_path) # If tail happens to be empty as in case `...
python
def make_dir_name_from_url(url): """This function attempts to emulate something like Git's "humanish" directory naming for clone. It's probably not a perfect facimile, but it's close.""" url_path = urlparse(url).path head, tail = os.path.split(url_path) # If tail happens to be empty as in case `...
[ "def", "make_dir_name_from_url", "(", "url", ")", ":", "url_path", "=", "urlparse", "(", "url", ")", ".", "path", "head", ",", "tail", "=", "os", ".", "path", ".", "split", "(", "url_path", ")", "# If tail happens to be empty as in case `/foo/`, use foo.", "# If...
This function attempts to emulate something like Git's "humanish" directory naming for clone. It's probably not a perfect facimile, but it's close.
[ "This", "function", "attempts", "to", "emulate", "something", "like", "Git", "s", "humanish", "directory", "naming", "for", "clone", ".", "It", "s", "probably", "not", "a", "perfect", "facimile", "but", "it", "s", "close", "." ]
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L177-L189
OpenAgInitiative/openag_python
openag/utils.py
safe_cpp_var
def safe_cpp_var(s): """ Given a string representing a variable, return a new string that is safe for C++ codegen. If string is already safe, will leave it alone. """ s = str(s) # Remove non-word, non-space characters s = re.sub(r"[^\w\s]", '', s) # Replace spaces with _ s = re.sub(r...
python
def safe_cpp_var(s): """ Given a string representing a variable, return a new string that is safe for C++ codegen. If string is already safe, will leave it alone. """ s = str(s) # Remove non-word, non-space characters s = re.sub(r"[^\w\s]", '', s) # Replace spaces with _ s = re.sub(r...
[ "def", "safe_cpp_var", "(", "s", ")", ":", "s", "=", "str", "(", "s", ")", "# Remove non-word, non-space characters", "s", "=", "re", ".", "sub", "(", "r\"[^\\w\\s]\"", ",", "''", ",", "s", ")", "# Replace spaces with _", "s", "=", "re", ".", "sub", "(",...
Given a string representing a variable, return a new string that is safe for C++ codegen. If string is already safe, will leave it alone.
[ "Given", "a", "string", "representing", "a", "variable", "return", "a", "new", "string", "that", "is", "safe", "for", "C", "++", "codegen", ".", "If", "string", "is", "already", "safe", "will", "leave", "it", "alone", "." ]
train
https://github.com/OpenAgInitiative/openag_python/blob/f6202340292bbf7185e1a7d4290188c0dacbb8d0/openag/utils.py#L209-L221
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
booleanise
def booleanise(b): """Normalise a 'stringified' Boolean to a proper Python Boolean. ElasticSearch has a habit of returning "true" and "false" in its JSON responses when it should be returning `true` and `false`. If `b` looks like a stringified Boolean true, return True. If `b` looks like a str...
python
def booleanise(b): """Normalise a 'stringified' Boolean to a proper Python Boolean. ElasticSearch has a habit of returning "true" and "false" in its JSON responses when it should be returning `true` and `false`. If `b` looks like a stringified Boolean true, return True. If `b` looks like a str...
[ "def", "booleanise", "(", "b", ")", ":", "s", "=", "str", "(", "b", ")", "if", "s", ".", "lower", "(", ")", "==", "\"true\"", ":", "return", "True", "if", "s", ".", "lower", "(", ")", "==", "\"false\"", ":", "return", "False", "return", "b" ]
Normalise a 'stringified' Boolean to a proper Python Boolean. ElasticSearch has a habit of returning "true" and "false" in its JSON responses when it should be returning `true` and `false`. If `b` looks like a stringified Boolean true, return True. If `b` looks like a stringified Boolean false, re...
[ "Normalise", "a", "stringified", "Boolean", "to", "a", "proper", "Python", "Boolean", "." ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L272-L290
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
fmt_bytes
def fmt_bytes(bytes, precision=2): """Reduce a large number of `bytes` down to a humanised SI equivalent and return the result as a string with trailing unit abbreviation. """ UNITS = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'] if bytes == 0: return '0 bytes' log = math.floor(math.l...
python
def fmt_bytes(bytes, precision=2): """Reduce a large number of `bytes` down to a humanised SI equivalent and return the result as a string with trailing unit abbreviation. """ UNITS = ['bytes', 'KB', 'MB', 'GB', 'TB', 'PB'] if bytes == 0: return '0 bytes' log = math.floor(math.l...
[ "def", "fmt_bytes", "(", "bytes", ",", "precision", "=", "2", ")", ":", "UNITS", "=", "[", "'bytes'", ",", "'KB'", ",", "'MB'", ",", "'GB'", ",", "'TB'", ",", "'PB'", "]", "if", "bytes", "==", "0", ":", "return", "'0 bytes'", "log", "=", "math", ...
Reduce a large number of `bytes` down to a humanised SI equivalent and return the result as a string with trailing unit abbreviation.
[ "Reduce", "a", "large", "number", "of", "bytes", "down", "to", "a", "humanised", "SI", "equivalent", "and", "return", "the", "result", "as", "a", "string", "with", "trailing", "unit", "abbreviation", "." ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L292-L307
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
Connection.get_index_translog_disable_flush
def get_index_translog_disable_flush(self): """Return a dictionary showing the position of the 'translog.disable_flush' knob for each index in the cluster. The dictionary will look like this: { "index1": True, # Autoflushing DISABLED "index2": ...
python
def get_index_translog_disable_flush(self): """Return a dictionary showing the position of the 'translog.disable_flush' knob for each index in the cluster. The dictionary will look like this: { "index1": True, # Autoflushing DISABLED "index2": ...
[ "def", "get_index_translog_disable_flush", "(", "self", ")", ":", "disabled", "=", "{", "}", "settings", "=", "self", ".", "get", "(", "'/_settings'", ")", "setting_getters", "=", "[", "lambda", "s", ":", "s", "[", "'index.translog.disable_flush'", "]", ",", ...
Return a dictionary showing the position of the 'translog.disable_flush' knob for each index in the cluster. The dictionary will look like this: { "index1": True, # Autoflushing DISABLED "index2": False, # Autoflushing ENABLED "inde...
[ "Return", "a", "dictionary", "showing", "the", "position", "of", "the", "translog", ".", "disable_flush", "knob", "for", "each", "index", "in", "the", "cluster", "." ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L103-L131
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
Connection.allocator_disabled
def allocator_disabled(self): """Return a simplified one-word answer to the question, 'Has the automatic shard allocator been disabled for this cluster?' The answer will be one of "disabled" (yes), "enabled" (no), or "unknown". """ state = "unknown" setting_ge...
python
def allocator_disabled(self): """Return a simplified one-word answer to the question, 'Has the automatic shard allocator been disabled for this cluster?' The answer will be one of "disabled" (yes), "enabled" (no), or "unknown". """ state = "unknown" setting_ge...
[ "def", "allocator_disabled", "(", "self", ")", ":", "state", "=", "\"unknown\"", "setting_getters", "=", "[", "lambda", "s", ":", "s", "[", "'cluster.routing.allocation.disable_allocation'", "]", ",", "lambda", "s", ":", "s", "[", "'cluster'", "]", "[", "'rout...
Return a simplified one-word answer to the question, 'Has the automatic shard allocator been disabled for this cluster?' The answer will be one of "disabled" (yes), "enabled" (no), or "unknown".
[ "Return", "a", "simplified", "one", "-", "word", "answer", "to", "the", "question", "Has", "the", "automatic", "shard", "allocator", "been", "disabled", "for", "this", "cluster?" ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L133-L156
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
Connection.flushing_disabled
def flushing_disabled(self): """Return a simplified one-word answer to the question, 'Has automatic transaction log flushing been disabled on all indexes in the cluster?' The answer will be one of "disabled" (yes, on all), "enabled" (no, on all), "some" (yes, only on some), o...
python
def flushing_disabled(self): """Return a simplified one-word answer to the question, 'Has automatic transaction log flushing been disabled on all indexes in the cluster?' The answer will be one of "disabled" (yes, on all), "enabled" (no, on all), "some" (yes, only on some), o...
[ "def", "flushing_disabled", "(", "self", ")", ":", "states", "=", "self", ".", "get_index_translog_disable_flush", "(", ")", ".", "values", "(", ")", "if", "not", "states", ":", "return", "\"unknown\"", "if", "all", "(", "s", "==", "True", "for", "s", "i...
Return a simplified one-word answer to the question, 'Has automatic transaction log flushing been disabled on all indexes in the cluster?' The answer will be one of "disabled" (yes, on all), "enabled" (no, on all), "some" (yes, only on some), or "unknown".
[ "Return", "a", "simplified", "one", "-", "word", "answer", "to", "the", "question", "Has", "automatic", "transaction", "log", "flushing", "been", "disabled", "on", "all", "indexes", "in", "the", "cluster?" ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L158-L176
anchor/elasticsearchadmin
esadmin/elasticsearchadmin.py
TabularPrinter.nontruncating_zip
def nontruncating_zip(*seqs): """Return a list of tuples, where each tuple contains the i-th element from each of the argument sequences. The returned list is as long as the longest argument sequence. Shorter argument sequences will be represented in the output as None paddi...
python
def nontruncating_zip(*seqs): """Return a list of tuples, where each tuple contains the i-th element from each of the argument sequences. The returned list is as long as the longest argument sequence. Shorter argument sequences will be represented in the output as None paddi...
[ "def", "nontruncating_zip", "(", "*", "seqs", ")", ":", "n_seqs", "=", "len", "(", "seqs", ")", "tups", "=", "[", "]", "idx", "=", "0", "while", "True", ":", "empties", "=", "0", "tup", "=", "[", "]", "for", "seq", "in", "seqs", ":", "try", ":"...
Return a list of tuples, where each tuple contains the i-th element from each of the argument sequences. The returned list is as long as the longest argument sequence. Shorter argument sequences will be represented in the output as None padding elements: nontruncating_z...
[ "Return", "a", "list", "of", "tuples", "where", "each", "tuple", "contains", "the", "i", "-", "th", "element", "from", "each", "of", "the", "argument", "sequences", "." ]
train
https://github.com/anchor/elasticsearchadmin/blob/80b5adf79ead341ce0ded34119b087a343425983/esadmin/elasticsearchadmin.py#L239-L270
erkghlerngm44/malaffinity
malaffinity/calcs.py
pearson
def pearson(x, y): """ Pearson's correlation implementation without scipy or numpy. :param list x: Dataset x :param list y: Dataset y :return: Population pearson correlation coefficient :rtype: float """ mx = Decimal(mean(x)) my = Decimal(mean(y)) xm = [Decimal(i) - mx for i in...
python
def pearson(x, y): """ Pearson's correlation implementation without scipy or numpy. :param list x: Dataset x :param list y: Dataset y :return: Population pearson correlation coefficient :rtype: float """ mx = Decimal(mean(x)) my = Decimal(mean(y)) xm = [Decimal(i) - mx for i in...
[ "def", "pearson", "(", "x", ",", "y", ")", ":", "mx", "=", "Decimal", "(", "mean", "(", "x", ")", ")", "my", "=", "Decimal", "(", "mean", "(", "y", ")", ")", "xm", "=", "[", "Decimal", "(", "i", ")", "-", "mx", "for", "i", "in", "x", "]",...
Pearson's correlation implementation without scipy or numpy. :param list x: Dataset x :param list y: Dataset y :return: Population pearson correlation coefficient :rtype: float
[ "Pearson", "s", "correlation", "implementation", "without", "scipy", "or", "numpy", "." ]
train
https://github.com/erkghlerngm44/malaffinity/blob/d866b9198b668333f0b86567b2faebdb20587e30/malaffinity/calcs.py#L13-L42
mitsei/dlkit
dlkit/json_/utilities.py
clean_up_datetime
def clean_up_datetime(obj_map): """convert datetime objects to dictionaries for storage""" clean_map = {} for key, value in obj_map.items(): if isinstance(value, datetime.datetime): clean_map[key] = { 'year': value.year, 'month': value.month, ...
python
def clean_up_datetime(obj_map): """convert datetime objects to dictionaries for storage""" clean_map = {} for key, value in obj_map.items(): if isinstance(value, datetime.datetime): clean_map[key] = { 'year': value.year, 'month': value.month, ...
[ "def", "clean_up_datetime", "(", "obj_map", ")", ":", "clean_map", "=", "{", "}", "for", "key", ",", "value", "in", "obj_map", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "datetime", ".", "datetime", ")", ":", "clean_map", "[", ...
convert datetime objects to dictionaries for storage
[ "convert", "datetime", "objects", "to", "dictionaries", "for", "storage" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L105-L135
mitsei/dlkit
dlkit/json_/utilities.py
convert_dict_to_datetime
def convert_dict_to_datetime(obj_map): """converts dictionary representations of datetime back to datetime obj""" converted_map = {} for key, value in obj_map.items(): if isinstance(value, dict) and 'tzinfo' in value.keys(): converted_map[key] = datetime.datetime(**value) elif is...
python
def convert_dict_to_datetime(obj_map): """converts dictionary representations of datetime back to datetime obj""" converted_map = {} for key, value in obj_map.items(): if isinstance(value, dict) and 'tzinfo' in value.keys(): converted_map[key] = datetime.datetime(**value) elif is...
[ "def", "convert_dict_to_datetime", "(", "obj_map", ")", ":", "converted_map", "=", "{", "}", "for", "key", ",", "value", "in", "obj_map", ".", "items", "(", ")", ":", "if", "isinstance", "(", "value", ",", "dict", ")", "and", "'tzinfo'", "in", "value", ...
converts dictionary representations of datetime back to datetime obj
[ "converts", "dictionary", "representations", "of", "datetime", "back", "to", "datetime", "obj" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L158-L176
mitsei/dlkit
dlkit/json_/utilities.py
convert_ids_to_object_ids
def convert_ids_to_object_ids(obj_map): """converts string representations of _id back to ObjectId obj""" converted_map = {} for key, value in obj_map.items(): if key == '_id': # hacky, but using alias sends back the whole ID string, like # assessment.Item%3A5758326b4a40452...
python
def convert_ids_to_object_ids(obj_map): """converts string representations of _id back to ObjectId obj""" converted_map = {} for key, value in obj_map.items(): if key == '_id': # hacky, but using alias sends back the whole ID string, like # assessment.Item%3A5758326b4a40452...
[ "def", "convert_ids_to_object_ids", "(", "obj_map", ")", ":", "converted_map", "=", "{", "}", "for", "key", ",", "value", "in", "obj_map", ".", "items", "(", ")", ":", "if", "key", "==", "'_id'", ":", "# hacky, but using alias sends back the whole ID string, like"...
converts string representations of _id back to ObjectId obj
[ "converts", "string", "representations", "of", "_id", "back", "to", "ObjectId", "obj" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L179-L203
mitsei/dlkit
dlkit/json_/utilities.py
fix_reserved_word
def fix_reserved_word(word, is_module=False): """ Replaces words that may be problematic In particular the term 'type' is used in the osid spec, primarily as an argument parameter where a type is provided to a method. 'type' is a reserved word in python, so we give ours a trailing underscore. If w...
python
def fix_reserved_word(word, is_module=False): """ Replaces words that may be problematic In particular the term 'type' is used in the osid spec, primarily as an argument parameter where a type is provided to a method. 'type' is a reserved word in python, so we give ours a trailing underscore. If w...
[ "def", "fix_reserved_word", "(", "word", ",", "is_module", "=", "False", ")", ":", "if", "is_module", ":", "if", "word", "==", "'logging'", ":", "word", "=", "'logging_'", "# Still deciding this", "else", ":", "if", "keyword", ".", "iskeyword", "(", "word", ...
Replaces words that may be problematic In particular the term 'type' is used in the osid spec, primarily as an argument parameter where a type is provided to a method. 'type' is a reserved word in python, so we give ours a trailing underscore. If we come across any other osid things that are reserved ...
[ "Replaces", "words", "that", "may", "be", "problematic" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L206-L226
mitsei/dlkit
dlkit/json_/utilities.py
remove_null_proxy_kwarg
def remove_null_proxy_kwarg(func): """decorator, to remove a 'proxy' keyword argument. For wrapping certain Manager methods""" def wrapper(*args, **kwargs): if 'proxy' in kwargs: # if kwargs['proxy'] is None: del kwargs['proxy'] # else: # raise InvalidA...
python
def remove_null_proxy_kwarg(func): """decorator, to remove a 'proxy' keyword argument. For wrapping certain Manager methods""" def wrapper(*args, **kwargs): if 'proxy' in kwargs: # if kwargs['proxy'] is None: del kwargs['proxy'] # else: # raise InvalidA...
[ "def", "remove_null_proxy_kwarg", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'proxy'", "in", "kwargs", ":", "# if kwargs['proxy'] is None:", "del", "kwargs", "[", "'proxy'", "]", "# else:", "# rais...
decorator, to remove a 'proxy' keyword argument. For wrapping certain Manager methods
[ "decorator", "to", "remove", "a", "proxy", "keyword", "argument", ".", "For", "wrapping", "certain", "Manager", "methods" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L665-L674
mitsei/dlkit
dlkit/json_/utilities.py
arguments_not_none
def arguments_not_none(func): """decorator, to check if any arguments are None; raise exception if so""" def wrapper(*args, **kwargs): for arg in args: if arg is None: raise NullArgument() for arg, val in kwargs.items(): if val is None: rai...
python
def arguments_not_none(func): """decorator, to check if any arguments are None; raise exception if so""" def wrapper(*args, **kwargs): for arg in args: if arg is None: raise NullArgument() for arg, val in kwargs.items(): if val is None: rai...
[ "def", "arguments_not_none", "(", "func", ")", ":", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "for", "arg", "in", "args", ":", "if", "arg", "is", "None", ":", "raise", "NullArgument", "(", ")", "for", "arg", ",", "val",...
decorator, to check if any arguments are None; raise exception if so
[ "decorator", "to", "check", "if", "any", "arguments", "are", "None", ";", "raise", "exception", "if", "so" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L677-L694
mitsei/dlkit
dlkit/json_/utilities.py
handle_simple_sequencing
def handle_simple_sequencing(func): """decorator, deal with simple sequencing cases""" from .assessment import assessment_utilities def wrapper(*args, **kwargs): # re-order these things because have to delete the part after # removing it from the parent sequence map if 'create_asses...
python
def handle_simple_sequencing(func): """decorator, deal with simple sequencing cases""" from .assessment import assessment_utilities def wrapper(*args, **kwargs): # re-order these things because have to delete the part after # removing it from the parent sequence map if 'create_asses...
[ "def", "handle_simple_sequencing", "(", "func", ")", ":", "from", ".", "assessment", "import", "assessment_utilities", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# re-order these things because have to delete the part after", "# removing it ...
decorator, deal with simple sequencing cases
[ "decorator", "deal", "with", "simple", "sequencing", "cases" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L697-L714
mitsei/dlkit
dlkit/json_/utilities.py
get_provider_manager
def get_provider_manager(osid, runtime=None, proxy=None, local=False): """ Gets the most appropriate provider manager depending on config. If local is True, then don't bother with the runtime/config and try to get the requested service manager directly from the local service implementations known t...
python
def get_provider_manager(osid, runtime=None, proxy=None, local=False): """ Gets the most appropriate provider manager depending on config. If local is True, then don't bother with the runtime/config and try to get the requested service manager directly from the local service implementations known t...
[ "def", "get_provider_manager", "(", "osid", ",", "runtime", "=", "None", ",", "proxy", "=", "None", ",", "local", "=", "False", ")", ":", "if", "runtime", "is", "not", "None", ":", "if", "local", ":", "parameter_id", "=", "Id", "(", "'parameter:localImpl...
Gets the most appropriate provider manager depending on config. If local is True, then don't bother with the runtime/config and try to get the requested service manager directly from the local service implementations known to this mongodb implementation.
[ "Gets", "the", "most", "appropriate", "provider", "manager", "depending", "on", "config", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L717-L755
mitsei/dlkit
dlkit/json_/utilities.py
get_registry
def get_registry(entry, runtime): """Returns a record registry given an entry and runtime""" try: records_location_param_id = Id('parameter:recordsRegistry@mongo') registry = runtime.get_configuration().get_value_by_parameter( records_location_param_id).get_string_value() ret...
python
def get_registry(entry, runtime): """Returns a record registry given an entry and runtime""" try: records_location_param_id = Id('parameter:recordsRegistry@mongo') registry = runtime.get_configuration().get_value_by_parameter( records_location_param_id).get_string_value() ret...
[ "def", "get_registry", "(", "entry", ",", "runtime", ")", ":", "try", ":", "records_location_param_id", "=", "Id", "(", "'parameter:recordsRegistry@mongo'", ")", "registry", "=", "runtime", ".", "get_configuration", "(", ")", ".", "get_value_by_parameter", "(", "r...
Returns a record registry given an entry and runtime
[ "Returns", "a", "record", "registry", "given", "an", "entry", "and", "runtime" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L810-L818
mitsei/dlkit
dlkit/json_/utilities.py
is_authenticated_with_proxy
def is_authenticated_with_proxy(proxy): """Given a Proxy, checks whether a user is authenticated""" if proxy is None: return False elif proxy.has_authentication(): return proxy.get_authentication().is_valid() else: return False
python
def is_authenticated_with_proxy(proxy): """Given a Proxy, checks whether a user is authenticated""" if proxy is None: return False elif proxy.has_authentication(): return proxy.get_authentication().is_valid() else: return False
[ "def", "is_authenticated_with_proxy", "(", "proxy", ")", ":", "if", "proxy", "is", "None", ":", "return", "False", "elif", "proxy", ".", "has_authentication", "(", ")", ":", "return", "proxy", ".", "get_authentication", "(", ")", ".", "is_valid", "(", ")", ...
Given a Proxy, checks whether a user is authenticated
[ "Given", "a", "Proxy", "checks", "whether", "a", "user", "is", "authenticated" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L821-L828
mitsei/dlkit
dlkit/json_/utilities.py
get_effective_agent_id_with_proxy
def get_effective_agent_id_with_proxy(proxy): """Given a Proxy, returns the Id of the effective Agent""" if is_authenticated_with_proxy(proxy): if proxy.has_effective_agent(): return proxy.get_effective_agent_id() else: return proxy.get_authentication().get_agent_id() ...
python
def get_effective_agent_id_with_proxy(proxy): """Given a Proxy, returns the Id of the effective Agent""" if is_authenticated_with_proxy(proxy): if proxy.has_effective_agent(): return proxy.get_effective_agent_id() else: return proxy.get_authentication().get_agent_id() ...
[ "def", "get_effective_agent_id_with_proxy", "(", "proxy", ")", ":", "if", "is_authenticated_with_proxy", "(", "proxy", ")", ":", "if", "proxy", ".", "has_effective_agent", "(", ")", ":", "return", "proxy", ".", "get_effective_agent_id", "(", ")", "else", ":", "r...
Given a Proxy, returns the Id of the effective Agent
[ "Given", "a", "Proxy", "returns", "the", "Id", "of", "the", "effective", "Agent" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L847-L858
mitsei/dlkit
dlkit/json_/utilities.py
get_locale_with_proxy
def get_locale_with_proxy(proxy): """Given a Proxy, returns the Locale This assumes that instantiating a dlkit.mongo.locale.objects.Locale without constructor arguments wlll return the default Locale. """ from .locale.objects import Locale if proxy is not None: locale = proxy.get_l...
python
def get_locale_with_proxy(proxy): """Given a Proxy, returns the Locale This assumes that instantiating a dlkit.mongo.locale.objects.Locale without constructor arguments wlll return the default Locale. """ from .locale.objects import Locale if proxy is not None: locale = proxy.get_l...
[ "def", "get_locale_with_proxy", "(", "proxy", ")", ":", "from", ".", "locale", ".", "objects", "import", "Locale", "if", "proxy", "is", "not", "None", ":", "locale", "=", "proxy", ".", "get_locale", "(", ")", "if", "locale", "is", "not", "None", ":", "...
Given a Proxy, returns the Locale This assumes that instantiating a dlkit.mongo.locale.objects.Locale without constructor arguments wlll return the default Locale.
[ "Given", "a", "Proxy", "returns", "the", "Locale" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L873-L885
mitsei/dlkit
dlkit/json_/utilities.py
convert_catalog_id_to_object_id_string
def convert_catalog_id_to_object_id_string(catalog_id): """When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45' """ if not isinst...
python
def convert_catalog_id_to_object_id_string(catalog_id): """When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45' """ if not isinst...
[ "def", "convert_catalog_id_to_object_id_string", "(", "catalog_id", ")", ":", "if", "not", "isinstance", "(", "catalog_id", ",", "Id", ")", ":", "raise", "TypeError", "(", "'input needs to be an Id'", ")", "seed_str", "=", "catalog_id", ".", "get_identifier", "(", ...
When doing hierarchies, need to convert a catalogId into an ObjectId, so convert to a string, then into a hex format. i.e. Bank Assessment hierarchy should become BANKASSESSME '42414e4b4153534553534d45'
[ "When", "doing", "hierarchies", "need", "to", "convert", "a", "catalogId", "into", "an", "ObjectId", "so", "convert", "to", "a", "string", "then", "into", "a", "hex", "format", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/utilities.py#L914-L938
cloud9ers/pylxc
lxc/__init__.py
create
def create(name, config_file=None, template=None, backing_store=None, template_options=None): ''' Create a new container raises ContainerAlreadyExists exception if the container name is reserved already. :param template_options: Options passed to the specified template :type template_opti...
python
def create(name, config_file=None, template=None, backing_store=None, template_options=None): ''' Create a new container raises ContainerAlreadyExists exception if the container name is reserved already. :param template_options: Options passed to the specified template :type template_opti...
[ "def", "create", "(", "name", ",", "config_file", "=", "None", ",", "template", "=", "None", ",", "backing_store", "=", "None", ",", "template_options", "=", "None", ")", ":", "if", "exists", "(", "name", ")", ":", "raise", "ContainerAlreadyExists", "(", ...
Create a new container raises ContainerAlreadyExists exception if the container name is reserved already. :param template_options: Options passed to the specified template :type template_options: list or None
[ "Create", "a", "new", "container", "raises", "ContainerAlreadyExists", "exception", "if", "the", "container", "name", "is", "reserved", "already", ".", ":", "param", "template_options", ":", "Options", "passed", "to", "the", "specified", "template", ":", "type", ...
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L60-L90
cloud9ers/pylxc
lxc/__init__.py
all_as_dict
def all_as_dict(): ''' returns a dict {'Running': ['cont1', 'cont2'], 'Stopped': ['cont3', 'cont4'] } ''' cmd = ['lxc-list'] out = subprocess.check_output(cmd).splitlines() stopped = [] running = [] frozen = [] ...
python
def all_as_dict(): ''' returns a dict {'Running': ['cont1', 'cont2'], 'Stopped': ['cont3', 'cont4'] } ''' cmd = ['lxc-list'] out = subprocess.check_output(cmd).splitlines() stopped = [] running = [] frozen = [] ...
[ "def", "all_as_dict", "(", ")", ":", "cmd", "=", "[", "'lxc-list'", "]", "out", "=", "subprocess", ".", "check_output", "(", "cmd", ")", ".", "splitlines", "(", ")", "stopped", "=", "[", "]", "running", "=", "[", "]", "frozen", "=", "[", "]", "curr...
returns a dict {'Running': ['cont1', 'cont2'], 'Stopped': ['cont3', 'cont4'] }
[ "returns", "a", "dict", "{", "Running", ":", "[", "cont1", "cont2", "]", "Stopped", ":", "[", "cont3", "cont4", "]", "}" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L115-L144
cloud9ers/pylxc
lxc/__init__.py
all_as_list
def all_as_list(): ''' returns a list of all defined containers ''' as_dict = all_as_dict() containers = as_dict['Running'] + as_dict['Frozen'] + as_dict['Stopped'] containers_list = [] for i in containers: i = i.replace(' (auto)', '') containers_list.append(i) ...
python
def all_as_list(): ''' returns a list of all defined containers ''' as_dict = all_as_dict() containers = as_dict['Running'] + as_dict['Frozen'] + as_dict['Stopped'] containers_list = [] for i in containers: i = i.replace(' (auto)', '') containers_list.append(i) ...
[ "def", "all_as_list", "(", ")", ":", "as_dict", "=", "all_as_dict", "(", ")", "containers", "=", "as_dict", "[", "'Running'", "]", "+", "as_dict", "[", "'Frozen'", "]", "+", "as_dict", "[", "'Stopped'", "]", "containers_list", "=", "[", "]", "for", "i", ...
returns a list of all defined containers
[ "returns", "a", "list", "of", "all", "defined", "containers" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L147-L157
cloud9ers/pylxc
lxc/__init__.py
start
def start(name, config_file=None): ''' starts a container in daemon mode ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) if name in running(): raise ContainerAlreadyRunning('The container %s is already started!' % name) cmd =...
python
def start(name, config_file=None): ''' starts a container in daemon mode ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) if name in running(): raise ContainerAlreadyRunning('The container %s is already started!' % name) cmd =...
[ "def", "start", "(", "name", ",", "config_file", "=", "None", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "if", "name", "in", "running", "(", ")", "...
starts a container in daemon mode
[ "starts", "a", "container", "in", "daemon", "mode" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L160-L171
cloud9ers/pylxc
lxc/__init__.py
stop
def stop(name): ''' stops a container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-stop', '-n', name] subprocess.check_call(cmd)
python
def stop(name): ''' stops a container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-stop', '-n', name] subprocess.check_call(cmd)
[ "def", "stop", "(", "name", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-stop'", ",", "'-n'", ",", "name", "]", "subprocess", ...
stops a container
[ "stops", "a", "container" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L174-L181
cloud9ers/pylxc
lxc/__init__.py
kill
def kill(name, signal): ''' sends a kill signal to process 1 of ths container <name> :param signal: numeric signal ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-kill', '--name=%s' % name, signal] subprocess.check_ca...
python
def kill(name, signal): ''' sends a kill signal to process 1 of ths container <name> :param signal: numeric signal ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-kill', '--name=%s' % name, signal] subprocess.check_ca...
[ "def", "kill", "(", "name", ",", "signal", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-kill'", ",", "'--name=%s'", "%", "name",...
sends a kill signal to process 1 of ths container <name> :param signal: numeric signal
[ "sends", "a", "kill", "signal", "to", "process", "1", "of", "ths", "container", "<name", ">", ":", "param", "signal", ":", "numeric", "signal" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L184-L192
cloud9ers/pylxc
lxc/__init__.py
shutdown
def shutdown(name, wait=False, reboot=False): ''' graceful shutdown sent to the container :param wait: should we wait for the shutdown to complete? :param reboot: reboot a container, ignores wait ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!...
python
def shutdown(name, wait=False, reboot=False): ''' graceful shutdown sent to the container :param wait: should we wait for the shutdown to complete? :param reboot: reboot a container, ignores wait ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!...
[ "def", "shutdown", "(", "name", ",", "wait", "=", "False", ",", "reboot", "=", "False", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[",...
graceful shutdown sent to the container :param wait: should we wait for the shutdown to complete? :param reboot: reboot a container, ignores wait
[ "graceful", "shutdown", "sent", "to", "the", "container", ":", "param", "wait", ":", "should", "we", "wait", "for", "the", "shutdown", "to", "complete?", ":", "param", "reboot", ":", "reboot", "a", "container", "ignores", "wait" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L195-L209
cloud9ers/pylxc
lxc/__init__.py
destroy
def destroy(name): ''' removes a container [stops a container if it's running and] raises ContainerNotExists exception if the specified name is not created ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-destroy', '-f', '-...
python
def destroy(name): ''' removes a container [stops a container if it's running and] raises ContainerNotExists exception if the specified name is not created ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-destroy', '-f', '-...
[ "def", "destroy", "(", "name", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-destroy'", ",", "'-f'", ",", "'-n'", ",", "name", ...
removes a container [stops a container if it's running and] raises ContainerNotExists exception if the specified name is not created
[ "removes", "a", "container", "[", "stops", "a", "container", "if", "it", "s", "running", "and", "]", "raises", "ContainerNotExists", "exception", "if", "the", "specified", "name", "is", "not", "created" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L212-L220
cloud9ers/pylxc
lxc/__init__.py
monitor
def monitor(name, callback): ''' monitors actions on the specified container, callback is a function to be called on ''' global _monitor if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) if _monitor: if _monitor.is_monitored...
python
def monitor(name, callback): ''' monitors actions on the specified container, callback is a function to be called on ''' global _monitor if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) if _monitor: if _monitor.is_monitored...
[ "def", "monitor", "(", "name", ",", "callback", ")", ":", "global", "_monitor", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "if", "_monitor", ":", "if", "_monitor...
monitors actions on the specified container, callback is a function to be called on
[ "monitors", "actions", "on", "the", "specified", "container", "callback", "is", "a", "function", "to", "be", "called", "on" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L223-L242
cloud9ers/pylxc
lxc/__init__.py
freeze
def freeze(name): ''' freezes the container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-freeze', '-n', name] subprocess.check_call(cmd)
python
def freeze(name): ''' freezes the container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-freeze', '-n', name] subprocess.check_call(cmd)
[ "def", "freeze", "(", "name", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-freeze'", ",", "'-n'", ",", "name", "]", "subprocess"...
freezes the container
[ "freezes", "the", "container" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L265-L272
cloud9ers/pylxc
lxc/__init__.py
unfreeze
def unfreeze(name): ''' unfreezes the container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-unfreeze', '-n', name] subprocess.check_call(cmd)
python
def unfreeze(name): ''' unfreezes the container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-unfreeze', '-n', name] subprocess.check_call(cmd)
[ "def", "unfreeze", "(", "name", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-unfreeze'", ",", "'-n'", ",", "name", "]", "subproc...
unfreezes the container
[ "unfreezes", "the", "container" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L275-L282
cloud9ers/pylxc
lxc/__init__.py
info
def info(name): ''' returns info dict about the specified container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-info', '-n', name] out = subprocess.check_output(cmd).splitlines() info = {} for line in out: ...
python
def info(name): ''' returns info dict about the specified container ''' if not exists(name): raise ContainerNotExists("The container (%s) does not exist!" % name) cmd = ['lxc-info', '-n', name] out = subprocess.check_output(cmd).splitlines() info = {} for line in out: ...
[ "def", "info", "(", "name", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-info'", ",", "'-n'", ",", "name", "]", "out", "=", ...
returns info dict about the specified container
[ "returns", "info", "dict", "about", "the", "specified", "container" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L285-L297
cloud9ers/pylxc
lxc/__init__.py
checkconfig
def checkconfig(): ''' returns the output of lxc-checkconfig ''' cmd = ['lxc-checkconfig'] return subprocess.check_output(cmd).replace('[1;32m', '').replace('[1;33m', '').replace('[0;39m', '').replace('[1;32m', '').replace(' ', '').split('\n')
python
def checkconfig(): ''' returns the output of lxc-checkconfig ''' cmd = ['lxc-checkconfig'] return subprocess.check_output(cmd).replace('[1;32m', '').replace('[1;33m', '').replace('[0;39m', '').replace('[1;32m', '').replace(' ', '').split('\n')
[ "def", "checkconfig", "(", ")", ":", "cmd", "=", "[", "'lxc-checkconfig'", "]", "return", "subprocess", ".", "check_output", "(", "cmd", ")", ".", "replace", "(", "'[1;32m'", ",", "''", ")", ".", "replace", "(", "'[1;33m'", ",", "''", ")", ".", "replac...
returns the output of lxc-checkconfig
[ "returns", "the", "output", "of", "lxc", "-", "checkconfig" ]
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L300-L305
cloud9ers/pylxc
lxc/__init__.py
notify
def notify(name, states, callback): ''' executes the callback function with no parameters when the container reaches the specified state or states states can be or-ed or and-ed notify('test', 'STOPPED', letmeknow) notify('test', 'STOPPED|RUNNING', letmeknow) ''' if n...
python
def notify(name, states, callback): ''' executes the callback function with no parameters when the container reaches the specified state or states states can be or-ed or and-ed notify('test', 'STOPPED', letmeknow) notify('test', 'STOPPED|RUNNING', letmeknow) ''' if n...
[ "def", "notify", "(", "name", ",", "states", ",", "callback", ")", ":", "if", "not", "exists", "(", "name", ")", ":", "raise", "ContainerNotExists", "(", "\"The container (%s) does not exist!\"", "%", "name", ")", "cmd", "=", "[", "'lxc-wait'", ",", "'-n'", ...
executes the callback function with no parameters when the container reaches the specified state or states states can be or-ed or and-ed notify('test', 'STOPPED', letmeknow) notify('test', 'STOPPED|RUNNING', letmeknow)
[ "executes", "the", "callback", "function", "with", "no", "parameters", "when", "the", "container", "reaches", "the", "specified", "state", "or", "states", "states", "can", "be", "or", "-", "ed", "or", "and", "-", "ed", "notify", "(", "test", "STOPPED", "le...
train
https://github.com/cloud9ers/pylxc/blob/588961dd37ce6e14fd7c1cc76d1970e48fccba34/lxc/__init__.py#L308-L324
mitsei/dlkit
dlkit/json_/grading/default_mdata.py
get_grade_mdata
def get_grade_mdata(): """Return default mdata map for Grade""" return { 'output_score': { 'element_label': { 'text': 'output score', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'forma...
python
def get_grade_mdata(): """Return default mdata map for Grade""" return { 'output_score': { 'element_label': { 'text': 'output score', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'forma...
[ "def", "get_grade_mdata", "(", ")", ":", "return", "{", "'output_score'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'output score'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'", ":", "str", "(", "D...
Return default mdata map for Grade
[ "Return", "default", "mdata", "map", "for", "Grade" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/default_mdata.py#L11-L107
mitsei/dlkit
dlkit/json_/grading/default_mdata.py
get_grade_system_mdata
def get_grade_system_mdata(): """Return default mdata map for GradeSystem""" return { 'numeric_score_increment': { 'element_label': { 'text': 'numeric score increment', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_S...
python
def get_grade_system_mdata(): """Return default mdata map for GradeSystem""" return { 'numeric_score_increment': { 'element_label': { 'text': 'numeric score increment', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_S...
[ "def", "get_grade_system_mdata", "(", ")", ":", "return", "{", "'numeric_score_increment'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'numeric score increment'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'"...
Return default mdata map for GradeSystem
[ "Return", "default", "mdata", "map", "for", "GradeSystem" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/default_mdata.py#L110-L205
mitsei/dlkit
dlkit/json_/grading/default_mdata.py
get_grade_entry_mdata
def get_grade_entry_mdata(): """Return default mdata map for GradeEntry""" return { 'resource': { 'element_label': { 'text': 'resource', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'fo...
python
def get_grade_entry_mdata(): """Return default mdata map for GradeEntry""" return { 'resource': { 'element_label': { 'text': 'resource', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), 'fo...
[ "def", "get_grade_entry_mdata", "(", ")", ":", "return", "{", "'resource'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'resource'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'", ":", "str", "(", "DEF...
Return default mdata map for GradeEntry
[ "Return", "default", "mdata", "map", "for", "GradeEntry" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/default_mdata.py#L208-L318
mitsei/dlkit
dlkit/json_/grading/default_mdata.py
get_gradebook_column_mdata
def get_gradebook_column_mdata(): """Return default mdata map for GradebookColumn""" return { 'grade_system': { 'element_label': { 'text': 'grade system', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
python
def get_gradebook_column_mdata(): """Return default mdata map for GradebookColumn""" return { 'grade_system': { 'element_label': { 'text': 'grade system', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(DEFAULT_SCRIPT_TYPE), ...
[ "def", "get_gradebook_column_mdata", "(", ")", ":", "return", "{", "'grade_system'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'grade system'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'", ":", "str", ...
Return default mdata map for GradebookColumn
[ "Return", "default", "mdata", "map", "for", "GradebookColumn" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/default_mdata.py#L321-L345
mitsei/dlkit
dlkit/json_/grading/default_mdata.py
get_gradebook_column_summary_mdata
def get_gradebook_column_summary_mdata(): """Return default mdata map for GradebookColumnSummary""" return { 'gradebook_column': { 'element_label': { 'text': 'gradebook column', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(...
python
def get_gradebook_column_summary_mdata(): """Return default mdata map for GradebookColumnSummary""" return { 'gradebook_column': { 'element_label': { 'text': 'gradebook column', 'languageTypeId': str(DEFAULT_LANGUAGE_TYPE), 'scriptTypeId': str(...
[ "def", "get_gradebook_column_summary_mdata", "(", ")", ":", "return", "{", "'gradebook_column'", ":", "{", "'element_label'", ":", "{", "'text'", ":", "'gradebook column'", ",", "'languageTypeId'", ":", "str", "(", "DEFAULT_LANGUAGE_TYPE", ")", ",", "'scriptTypeId'", ...
Return default mdata map for GradebookColumnSummary
[ "Return", "default", "mdata", "map", "for", "GradebookColumnSummary" ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/grading/default_mdata.py#L348-L372
njharman/die
die/roll.py
Roll.add_die
def add_die(self, die, count=1): '''Add ``Die`` to Roll. :param die: Die instance :param count: number of times die is rolled ''' for x in range(count): self._dice.append(die) self._odds = None
python
def add_die(self, die, count=1): '''Add ``Die`` to Roll. :param die: Die instance :param count: number of times die is rolled ''' for x in range(count): self._dice.append(die) self._odds = None
[ "def", "add_die", "(", "self", ",", "die", ",", "count", "=", "1", ")", ":", "for", "x", "in", "range", "(", "count", ")", ":", "self", ".", "_dice", ".", "append", "(", "die", ")", "self", ".", "_odds", "=", "None" ]
Add ``Die`` to Roll. :param die: Die instance :param count: number of times die is rolled
[ "Add", "Die", "to", "Roll", ".", ":", "param", "die", ":", "Die", "instance", ":", "param", "count", ":", "number", "of", "times", "die", "is", "rolled" ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L64-L71
njharman/die
die/roll.py
Roll.remove_die
def remove_die(self, die): '''Remove ``Die`` (first matching) from Roll. :param die: Die instance ''' if die in self._dice: self._dice.remove(die)
python
def remove_die(self, die): '''Remove ``Die`` (first matching) from Roll. :param die: Die instance ''' if die in self._dice: self._dice.remove(die)
[ "def", "remove_die", "(", "self", ",", "die", ")", ":", "if", "die", "in", "self", ".", "_dice", ":", "self", ".", "_dice", ".", "remove", "(", "die", ")" ]
Remove ``Die`` (first matching) from Roll. :param die: Die instance
[ "Remove", "Die", "(", "first", "matching", ")", "from", "Roll", ".", ":", "param", "die", ":", "Die", "instance" ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L73-L78
njharman/die
die/roll.py
Roll.roll
def roll(self, count=0, func=sum): '''Roll some dice! :param count: [0] Return list of sums :param func: [sum] Apply func to list of individual die rolls func([]) :return: A single sum or list of ``count`` sums ''' if count: return [func([die.roll() for die in...
python
def roll(self, count=0, func=sum): '''Roll some dice! :param count: [0] Return list of sums :param func: [sum] Apply func to list of individual die rolls func([]) :return: A single sum or list of ``count`` sums ''' if count: return [func([die.roll() for die in...
[ "def", "roll", "(", "self", ",", "count", "=", "0", ",", "func", "=", "sum", ")", ":", "if", "count", ":", "return", "[", "func", "(", "[", "die", ".", "roll", "(", ")", "for", "die", "in", "self", ".", "_dice", "]", ")", "for", "x", "in", ...
Roll some dice! :param count: [0] Return list of sums :param func: [sum] Apply func to list of individual die rolls func([]) :return: A single sum or list of ``count`` sums
[ "Roll", "some", "dice!", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "sums", ":", "param", "func", ":", "[", "sum", "]", "Apply", "func", "to", "list", "of", "individual", "die", "rolls", "func", "(", "[]", ")", ":", "return"...
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L80-L89
njharman/die
die/roll.py
Roll.x_rolls
def x_rolls(self, number, count=0, func=sum): '''Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([]) ''' for x in range(number): yield self.roll(count, func)
python
def x_rolls(self, number, count=0, func=sum): '''Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([]) ''' for x in range(number): yield self.roll(count, func)
[ "def", "x_rolls", "(", "self", ",", "number", ",", "count", "=", "0", ",", "func", "=", "sum", ")", ":", "for", "x", "in", "range", "(", "number", ")", ":", "yield", "self", ".", "roll", "(", "count", ",", "func", ")" ]
Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([])
[ "Iterator", "of", "number", "dice", "rolls", ".", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "count", "sums", ":", "param", "func", ":", "[", "sum", "]", "Apply", "func", "to", "list", "of", "individual", "die", "rolls", "func...
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L91-L97
njharman/die
die/roll.py
Roll.iter
def iter(self, count=0, func=sum): '''Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([]) ''' while True: yield self.roll(count, func)
python
def iter(self, count=0, func=sum): '''Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([]) ''' while True: yield self.roll(count, func)
[ "def", "iter", "(", "self", ",", "count", "=", "0", ",", "func", "=", "sum", ")", ":", "while", "True", ":", "yield", "self", ".", "roll", "(", "count", ",", "func", ")" ]
Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums :param func: [sum] Apply func to list of individual die rolls func([])
[ "Iterator", "of", "infinite", "dice", "rolls", ".", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "count", "sums", ":", "param", "func", ":", "[", "sum", "]", "Apply", "func", "to", "list", "of", "individual", "die", "rolls", "fu...
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L99-L105
njharman/die
die/roll.py
Roll._calc_odds
def _calc_odds(self): '''Calculates the absolute probability of all posible rolls.''' def recur(val, h, dice, combinations): for pip in dice[0]: tot = val + pip if len(dice) > 1: combinations = recur(tot, h, dice[1:], combinations) ...
python
def _calc_odds(self): '''Calculates the absolute probability of all posible rolls.''' def recur(val, h, dice, combinations): for pip in dice[0]: tot = val + pip if len(dice) > 1: combinations = recur(tot, h, dice[1:], combinations) ...
[ "def", "_calc_odds", "(", "self", ")", ":", "def", "recur", "(", "val", ",", "h", ",", "dice", ",", "combinations", ")", ":", "for", "pip", "in", "dice", "[", "0", "]", ":", "tot", "=", "val", "+", "pip", "if", "len", "(", "dice", ")", ">", "...
Calculates the absolute probability of all posible rolls.
[ "Calculates", "the", "absolute", "probability", "of", "all", "posible", "rolls", "." ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L107-L127
njharman/die
die/roll.py
FuncRoll.roll
def roll(self, count=0): '''Roll some dice! :param count: [0] Return list of sums :return: A single sum or list of ``count`` sums ''' return super(FuncRoll, self).roll(count, self._func)
python
def roll(self, count=0): '''Roll some dice! :param count: [0] Return list of sums :return: A single sum or list of ``count`` sums ''' return super(FuncRoll, self).roll(count, self._func)
[ "def", "roll", "(", "self", ",", "count", "=", "0", ")", ":", "return", "super", "(", "FuncRoll", ",", "self", ")", ".", "roll", "(", "count", ",", "self", ".", "_func", ")" ]
Roll some dice! :param count: [0] Return list of sums :return: A single sum or list of ``count`` sums
[ "Roll", "some", "dice!", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "sums", ":", "return", ":", "A", "single", "sum", "or", "list", "of", "count", "sums" ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L139-L144
njharman/die
die/roll.py
FuncRoll.x_rolls
def x_rolls(self, number, count=0): '''Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums ''' for x in range(number): yield super(FuncRoll, self).roll(count, self._func)
python
def x_rolls(self, number, count=0): '''Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums ''' for x in range(number): yield super(FuncRoll, self).roll(count, self._func)
[ "def", "x_rolls", "(", "self", ",", "number", ",", "count", "=", "0", ")", ":", "for", "x", "in", "range", "(", "number", ")", ":", "yield", "super", "(", "FuncRoll", ",", "self", ")", ".", "roll", "(", "count", ",", "self", ".", "_func", ")" ]
Iterator of number dice rolls. :param count: [0] Return list of ``count`` sums
[ "Iterator", "of", "number", "dice", "rolls", ".", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "count", "sums" ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L146-L151
njharman/die
die/roll.py
FuncRoll.iter
def iter(self, count=0): '''Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums ''' while True: yield super(FuncRoll, self).roll(count, self._func)
python
def iter(self, count=0): '''Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums ''' while True: yield super(FuncRoll, self).roll(count, self._func)
[ "def", "iter", "(", "self", ",", "count", "=", "0", ")", ":", "while", "True", ":", "yield", "super", "(", "FuncRoll", ",", "self", ")", ".", "roll", "(", "count", ",", "self", ".", "_func", ")" ]
Iterator of infinite dice rolls. :param count: [0] Return list of ``count`` sums
[ "Iterator", "of", "infinite", "dice", "rolls", ".", ":", "param", "count", ":", "[", "0", "]", "Return", "list", "of", "count", "sums" ]
train
https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/roll.py#L153-L158
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceLookupSession.get_resource
def get_resource(self, resource_id): """Gets the ``Resource`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Resource`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id``...
python
def get_resource(self, resource_id): """Gets the ``Resource`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Resource`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id``...
[ "def", "get_resource", "(", "self", ",", "resource_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resource", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", ...
Gets the ``Resource`` specified by its ``Id``. In plenary mode, the exact ``Id`` is found or a ``NotFound`` results. Otherwise, the returned ``Resource`` may have a different ``Id`` than requested, such as the case where a duplicate ``Id`` was assigned to a ``Resource`` and retained for...
[ "Gets", "the", "Resource", "specified", "by", "its", "Id", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L195-L223
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceLookupSession.get_resources_by_ids
def get_resources_by_ids(self, resource_ids): """Gets a ``ResourceList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the resources specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id``...
python
def get_resources_by_ids(self, resource_ids): """Gets a ``ResourceList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the resources specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id``...
[ "def", "get_resources_by_ids", "(", "self", ",", "resource_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_ids", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'res...
Gets a ``ResourceList`` corresponding to the given ``IdList``. In plenary mode, the returned list contains all of the resources specified in the ``Id`` list, in the order of the list, including duplicates, or an error results if an ``Id`` in the supplied list is not found or inaccessibl...
[ "Gets", "a", "ResourceList", "corresponding", "to", "the", "given", "IdList", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L226-L267
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceLookupSession.get_resources_by_genus_type
def get_resources_by_genus_type(self, resource_genus_type): """Gets a ``ResourceList`` corresponding to the given resource genus ``Type`` which does not include resources of types derived from the specified ``Type``. In plenary mode, the returned list contains all known resources or an error re...
python
def get_resources_by_genus_type(self, resource_genus_type): """Gets a ``ResourceList`` corresponding to the given resource genus ``Type`` which does not include resources of types derived from the specified ``Type``. In plenary mode, the returned list contains all known resources or an error re...
[ "def", "get_resources_by_genus_type", "(", "self", ",", "resource_genus_type", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources_by_genus_type", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValid...
Gets a ``ResourceList`` corresponding to the given resource genus ``Type`` which does not include resources of types derived from the specified ``Type``. In plenary mode, the returned list contains all known resources or an error results. Otherwise, the returned list may contain only those reso...
[ "Gets", "a", "ResourceList", "corresponding", "to", "the", "given", "resource", "genus", "Type", "which", "does", "not", "include", "resources", "of", "types", "derived", "from", "the", "specified", "Type", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L270-L296
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceLookupSession.get_resources
def get_resources(self): """Gets all ``Resources``. In plenary mode, the returned list contains all known resources or an error results. Otherwise, the returned list may contain only those resources that are accessible through this session. return: (osid.resource.ResourceList) ...
python
def get_resources(self): """Gets all ``Resources``. In plenary mode, the returned list contains all known resources or an error results. Otherwise, the returned list may contain only those resources that are accessible through this session. return: (osid.resource.ResourceList) ...
[ "def", "get_resources", "(", "self", ")", ":", "# Implemented from template for", "# osid.resource.ResourceLookupSession.get_resources", "# NOTE: This implementation currently ignores plenary view", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", "collection", "=", ...
Gets all ``Resources``. In plenary mode, the returned list contains all known resources or an error results. Otherwise, the returned list may contain only those resources that are accessible through this session. return: (osid.resource.ResourceList) - a list of ``Resources`` ra...
[ "Gets", "all", "Resources", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L344-L364
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceQuerySession.get_resources_by_query
def get_resources_by_query(self, resource_query): """Gets a list of ``Resources`` matching the given resource query. arg: resource_query (osid.resource.ResourceQuery): the resource query return: (osid.resource.ResourceList) - the returned ``ResourceList`` ...
python
def get_resources_by_query(self, resource_query): """Gets a list of ``Resources`` matching the given resource query. arg: resource_query (osid.resource.ResourceQuery): the resource query return: (osid.resource.ResourceList) - the returned ``ResourceList`` ...
[ "def", "get_resources_by_query", "(", "self", ",", "resource_query", ")", ":", "# Implemented from template for", "# osid.resource.ResourceQuerySession.get_resources_by_query", "and_list", "=", "list", "(", ")", "or_list", "=", "list", "(", ")", "for", "term", "in", "re...
Gets a list of ``Resources`` matching the given resource query. arg: resource_query (osid.resource.ResourceQuery): the resource query return: (osid.resource.ResourceList) - the returned ``ResourceList`` raise: NullArgument - ``resource_query`` is ``null`` ...
[ "Gets", "a", "list", "of", "Resources", "matching", "the", "given", "resource", "query", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L491-L531
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceSearchSession.get_resources_by_search
def get_resources_by_search(self, resource_query, resource_search): """Gets the search results matching the given search query using the given search. arg: resource_query (osid.resource.ResourceQuery): the resource query arg: resource_search (osid.resource.ResourceSearch):...
python
def get_resources_by_search(self, resource_query, resource_search): """Gets the search results matching the given search query using the given search. arg: resource_query (osid.resource.ResourceQuery): the resource query arg: resource_search (osid.resource.ResourceSearch):...
[ "def", "get_resources_by_search", "(", "self", ",", "resource_query", ",", "resource_search", ")", ":", "# Implemented from template for", "# osid.resource.ResourceSearchSession.get_resources_by_search_template", "# Copied from osid.resource.ResourceQuerySession.get_resources_by_query_templa...
Gets the search results matching the given search query using the given search. arg: resource_query (osid.resource.ResourceQuery): the resource query arg: resource_search (osid.resource.ResourceSearch): the resource search return: (osid.resource.ResourceSea...
[ "Gets", "the", "search", "results", "matching", "the", "given", "search", "query", "using", "the", "given", "search", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L592-L636
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceAdminSession.get_resource_form_for_create
def get_resource_form_for_create(self, resource_record_types): """Gets the resource form for creating new resources. A new form should be requested for each create transaction. arg: resource_record_types (osid.type.Type[]): array of resource record types return: (osi...
python
def get_resource_form_for_create(self, resource_record_types): """Gets the resource form for creating new resources. A new form should be requested for each create transaction. arg: resource_record_types (osid.type.Type[]): array of resource record types return: (osi...
[ "def", "get_resource_form_for_create", "(", "self", ",", "resource_record_types", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.get_resource_form_for_create_template", "for", "arg", "in", "resource_record_types", ":", "if", "not", "isinstance", ...
Gets the resource form for creating new resources. A new form should be requested for each create transaction. arg: resource_record_types (osid.type.Type[]): array of resource record types return: (osid.resource.ResourceForm) - the resource form raise: NullArgument ...
[ "Gets", "the", "resource", "form", "for", "creating", "new", "resources", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L780-L815
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceAdminSession.create_resource
def create_resource(self, resource_form): """Creates a new ``Resource``. arg: resource_form (osid.resource.ResourceForm): the form for this ``Resource`` return: (osid.resource.Resource) - the new ``Resource`` raise: IllegalState - ``resource_form`` already used in a ...
python
def create_resource(self, resource_form): """Creates a new ``Resource``. arg: resource_form (osid.resource.ResourceForm): the form for this ``Resource`` return: (osid.resource.Resource) - the new ``Resource`` raise: IllegalState - ``resource_form`` already used in a ...
[ "def", "create_resource", "(", "self", ",", "resource_form", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.create_resource_template", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", "collection", "=", "'Resource'", ",", "...
Creates a new ``Resource``. arg: resource_form (osid.resource.ResourceForm): the form for this ``Resource`` return: (osid.resource.Resource) - the new ``Resource`` raise: IllegalState - ``resource_form`` already used in a create transaction raise: In...
[ "Creates", "a", "new", "Resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L818-L860
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceAdminSession.update_resource
def update_resource(self, resource_form): """Updates an existing resource. arg: resource_form (osid.resource.ResourceForm): the form containing the elements to be updated raise: IllegalState - ``resource_form`` already used in an update transaction ra...
python
def update_resource(self, resource_form): """Updates an existing resource. arg: resource_form (osid.resource.ResourceForm): the form containing the elements to be updated raise: IllegalState - ``resource_form`` already used in an update transaction ra...
[ "def", "update_resource", "(", "self", ",", "resource_form", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.update_resource_template", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", "collection", "=", "'Resource'", ",", "...
Updates an existing resource. arg: resource_form (osid.resource.ResourceForm): the form containing the elements to be updated raise: IllegalState - ``resource_form`` already used in an update transaction raise: InvalidArgument - the form contains an invalid ...
[ "Updates", "an", "existing", "resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L916-L956
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceAdminSession.delete_resource
def delete_resource(self, resource_id): """Deletes a ``Resource``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to remove raise: NotFound - ``resource_id`` not found raise: NullArgument - ``resource_id`` is ``null`` raise: OperationFailed -...
python
def delete_resource(self, resource_id): """Deletes a ``Resource``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to remove raise: NotFound - ``resource_id`` not found raise: NullArgument - ``resource_id`` is ``null`` raise: OperationFailed -...
[ "def", "delete_resource", "(", "self", ",", "resource_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.delete_resource_template", "collection", "=", "JSONClientValidated", "(", "'resource'", ",", "collection", "=", "'Resource'", ",", "ru...
Deletes a ``Resource``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to remove raise: NotFound - ``resource_id`` not found raise: NullArgument - ``resource_id`` is ``null`` raise: OperationFailed - unable to complete request raise: Permiss...
[ "Deletes", "a", "Resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L979-L1003
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceAdminSession.alias_resource
def alias_resource(self, resource_id, alias_id): """Adds an ``Id`` to a ``Resource`` for the purpose of creating compatibility. The primary ``Id`` of the ``Resource`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to a...
python
def alias_resource(self, resource_id, alias_id): """Adds an ``Id`` to a ``Resource`` for the purpose of creating compatibility. The primary ``Id`` of the ``Resource`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to a...
[ "def", "alias_resource", "(", "self", ",", "resource_id", ",", "alias_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceAdminSession.alias_resources_template", "self", ".", "_alias_id", "(", "primary_id", "=", "resource_id", ",", "equivalent_id", "=...
Adds an ``Id`` to a ``Resource`` for the purpose of creating compatibility. The primary ``Id`` of the ``Resource`` is determined by the provider. The new ``Id`` performs as an alias to the primary ``Id``. If the alias is a pointer to another resource it is reassigned to the given resour...
[ "Adds", "an", "Id", "to", "a", "Resource", "for", "the", "purpose", "of", "creating", "compatibility", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1024-L1045
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceNotificationSession.register_for_deleted_resource
def register_for_deleted_resource(self, resource_id): """Registers for notification of a deleted resource. ``ResourceReceiver.deletedResources()`` is invoked when the specified resource is deleted or removed from this bin. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`...
python
def register_for_deleted_resource(self, resource_id): """Registers for notification of a deleted resource. ``ResourceReceiver.deletedResources()`` is invoked when the specified resource is deleted or removed from this bin. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`...
[ "def", "register_for_deleted_resource", "(", "self", ",", "resource_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceNotificationSession.register_for_deleted_resource", "if", "not", "MONGO_LISTENER", ".", "receivers", "[", "self", ".", "_ns", "]", "[...
Registers for notification of a deleted resource. ``ResourceReceiver.deletedResources()`` is invoked when the specified resource is deleted or removed from this bin. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` to monitor raise: NullArgument - ``res...
[ "Registers", "for", "notification", "of", "a", "deleted", "resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1240-L1259
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_resource_ids_by_bin
def get_resource_ids_by_bin(self, bin_id): """Gets the list of ``Resource`` ``Ids`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.id.IdList) - list of related resource ``Ids`` raise: NotFound - ``bin_id`` is not found raise: NullArg...
python
def get_resource_ids_by_bin(self, bin_id): """Gets the list of ``Resource`` ``Ids`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.id.IdList) - list of related resource ``Ids`` raise: NotFound - ``bin_id`` is not found raise: NullArg...
[ "def", "get_resource_ids_by_bin", "(", "self", ",", "bin_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_resource_ids_by_bin", "id_list", "=", "[", "]", "for", "resource", "in", "self", ".", "get_resources_by_bin", "(", "bin_id", ...
Gets the list of ``Resource`` ``Ids`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.id.IdList) - list of related resource ``Ids`` raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: Operati...
[ "Gets", "the", "list", "of", "Resource", "Ids", "associated", "with", "a", "Bin", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1373-L1390
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_resources_by_bin
def get_resources_by_bin(self, bin_id): """Gets the list of ``Resources`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.resource.ResourceList) - list of related resources raise: NotFound - ``bin_id`` is not found raise: NullArgument ...
python
def get_resources_by_bin(self, bin_id): """Gets the list of ``Resources`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.resource.ResourceList) - list of related resources raise: NotFound - ``bin_id`` is not found raise: NullArgument ...
[ "def", "get_resources_by_bin", "(", "self", ",", "bin_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_resources_by_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'RESOURCE'", ",", "local", "=", "True", ")", "lookup_...
Gets the list of ``Resources`` associated with a ``Bin``. arg: bin_id (osid.id.Id): ``Id`` of a ``Bin`` return: (osid.resource.ResourceList) - list of related resources raise: NotFound - ``bin_id`` is not found raise: NullArgument - ``bin_id`` is ``null`` raise: OperationF...
[ "Gets", "the", "list", "of", "Resources", "associated", "with", "a", "Bin", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1393-L1410
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_resource_ids_by_bins
def get_resource_ids_by_bins(self, bin_ids): """Gets the list of ``Resource Ids`` corresponding to a list of ``Bin`` objects. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.id.IdList) - list of resource ``Ids`` raise: NullArgument - ``bin_ids`` is ``null`` ...
python
def get_resource_ids_by_bins(self, bin_ids): """Gets the list of ``Resource Ids`` corresponding to a list of ``Bin`` objects. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.id.IdList) - list of resource ``Ids`` raise: NullArgument - ``bin_ids`` is ``null`` ...
[ "def", "get_resource_ids_by_bins", "(", "self", ",", "bin_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_resource_ids_by_bins", "id_list", "=", "[", "]", "for", "resource", "in", "self", ".", "get_resources_by_bins", "(", "bin_ids...
Gets the list of ``Resource Ids`` corresponding to a list of ``Bin`` objects. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.id.IdList) - list of resource ``Ids`` raise: NullArgument - ``bin_ids`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Gets", "the", "list", "of", "Resource", "Ids", "corresponding", "to", "a", "list", "of", "Bin", "objects", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1413-L1429
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_resources_by_bins
def get_resources_by_bins(self, bin_ids): """Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: ...
python
def get_resources_by_bins(self, bin_ids): """Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: ...
[ "def", "get_resources_by_bins", "(", "self", ",", "bin_ids", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_resources_by_bins", "resource_list", "=", "[", "]", "for", "bin_id", "in", "bin_ids", ":", "resource_list", "+=", "list", "(",...
Gets the list of ``Resources`` corresponding to a list of ``Bins``. arg: bin_ids (osid.id.IdList): list of bin ``Ids`` return: (osid.resource.ResourceList) - list of resources raise: NullArgument - ``bin_ids`` is ``null`` raise: OperationFailed - unable to complete request ...
[ "Gets", "the", "list", "of", "Resources", "corresponding", "to", "a", "list", "of", "Bins", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1432-L1449
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_bin_ids_by_resource
def get_bin_ids_by_resource(self, resource_id): """Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullAr...
python
def get_bin_ids_by_resource(self, resource_id): """Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullAr...
[ "def", "get_bin_ids_by_resource", "(", "self", ",", "resource_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_bin_ids_by_resource", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'RESOURCE'", ",", "local", "=", "True", ")",...
Gets the list of ``Bin`` ``Ids`` mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.id.IdList) - list of bin ``Ids`` raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Operat...
[ "Gets", "the", "list", "of", "Bin", "Ids", "mapped", "to", "a", "Resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1452-L1473
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinSession.get_bins_by_resource
def get_bins_by_resource(self, resource_id): """Gets the list of ``Bin`` objects mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.resource.BinList) - list of bins raise: NotFound - ``resource_id`` is not found raise: NullArgume...
python
def get_bins_by_resource(self, resource_id): """Gets the list of ``Bin`` objects mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.resource.BinList) - list of bins raise: NotFound - ``resource_id`` is not found raise: NullArgume...
[ "def", "get_bins_by_resource", "(", "self", ",", "resource_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinSession.get_bins_by_resource", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'RESOURCE'", ",", "local", "=", "True", ")", "lo...
Gets the list of ``Bin`` objects mapped to a ``Resource``. arg: resource_id (osid.id.Id): ``Id`` of a ``Resource`` return: (osid.resource.BinList) - list of bins raise: NotFound - ``resource_id`` is not found raise: NullArgument - ``resource_id`` is ``null`` raise: Operati...
[ "Gets", "the", "list", "of", "Bin", "objects", "mapped", "to", "a", "Resource", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1476-L1493
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinAssignmentSession.get_assignable_bin_ids
def get_assignable_bin_ids(self, bin_id): """Gets a list of bins including and under the given bin node in which any resource can be assigned. arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` return: (osid.id.IdList) - list of assignable bin ``Ids`` raise: NullArgument - ``bin_id...
python
def get_assignable_bin_ids(self, bin_id): """Gets a list of bins including and under the given bin node in which any resource can be assigned. arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` return: (osid.id.IdList) - list of assignable bin ``Ids`` raise: NullArgument - ``bin_id...
[ "def", "get_assignable_bin_ids", "(", "self", ",", "bin_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.get_assignable_bin_ids", "# This will likely be overridden by an authorization adapter", "mgr", "=", "self", ".", "_get_provider_manag...
Gets a list of bins including and under the given bin node in which any resource can be assigned. arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` return: (osid.id.IdList) - list of assignable bin ``Ids`` raise: NullArgument - ``bin_id`` is ``null`` raise: OperationFailed - unab...
[ "Gets", "a", "list", "of", "bins", "including", "and", "under", "the", "given", "bin", "node", "in", "which", "any", "resource", "can", "be", "assigned", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1562-L1581
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinAssignmentSession.assign_resource_to_bin
def assign_resource_to_bin(self, resource_id, bin_id): """Adds an existing ``Resource`` to a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: AlreadyExists - ``resource_id`` is already assigned to ...
python
def assign_resource_to_bin(self, resource_id, bin_id): """Adds an existing ``Resource`` to a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: AlreadyExists - ``resource_id`` is already assigned to ...
[ "def", "assign_resource_to_bin", "(", "self", ",", "resource_id", ",", "bin_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.assign_resource_to_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'RESOURCE'", ",", "loca...
Adds an existing ``Resource`` to a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: AlreadyExists - ``resource_id`` is already assigned to ``bin_id`` raise: NotFound - ``resource_id`...
[ "Adds", "an", "existing", "Resource", "to", "a", "Bin", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1601-L1620
mitsei/dlkit
dlkit/json_/resource/sessions.py
ResourceBinAssignmentSession.unassign_resource_from_bin
def unassign_resource_from_bin(self, resource_id, bin_id): """Removes a ``Resource`` from a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: NotFound - ``resource_id`` or ``bin_id`` not found or ...
python
def unassign_resource_from_bin(self, resource_id, bin_id): """Removes a ``Resource`` from a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: NotFound - ``resource_id`` or ``bin_id`` not found or ...
[ "def", "unassign_resource_from_bin", "(", "self", ",", "resource_id", ",", "bin_id", ")", ":", "# Implemented from template for", "# osid.resource.ResourceBinAssignmentSession.unassign_resource_from_bin", "mgr", "=", "self", ".", "_get_provider_manager", "(", "'RESOURCE'", ",",...
Removes a ``Resource`` from a ``Bin``. arg: resource_id (osid.id.Id): the ``Id`` of the ``Resource`` arg: bin_id (osid.id.Id): the ``Id`` of the ``Bin`` raise: NotFound - ``resource_id`` or ``bin_id`` not found or ``resource_id`` not assigned to ``bin_id`` raise: ...
[ "Removes", "a", "Resource", "from", "a", "Bin", "." ]
train
https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/resource/sessions.py#L1623-L1641