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 |
|---|---|---|---|---|---|---|---|---|---|---|
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_query_session_for_repository | def get_composition_query_session_for_repository(self, repository_id, proxy):
"""Gets a composition query session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionQuerySes... | python | def get_composition_query_session_for_repository(self, repository_id, proxy):
"""Gets a composition query session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionQuerySes... | [
"def",
"get_composition_query_session_for_repository",
"(",
"self",
",",
"repository_id",
",",
"proxy",
")",
":",
"if",
"repository_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"not",
"self",
".",
"supports_composition_query",
"(",
")",
":",
... | Gets a composition query session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionQuerySession) - a
CompositionQuerySession
raise: NotFound - repository_i... | [
"Gets",
"a",
"composition",
"query",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2671-L2701 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_search_session | def get_composition_search_session(self, proxy):
"""Gets a composition search session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearchSession) - a
CompositionSearchSession
raise: OperationFailed - unable to complete request
r... | python | def get_composition_search_session(self, proxy):
"""Gets a composition search session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearchSession) - a
CompositionSearchSession
raise: OperationFailed - unable to complete request
r... | [
"def",
"get_composition_search_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_composition_search",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"import",
"sessions",
"except",
"ImportError",
":... | Gets a composition search session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearchSession) - a
CompositionSearchSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_composition_search() is fals... | [
"Gets",
"a",
"composition",
"search",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2703-L2726 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_search_session_for_repository | def get_composition_search_session_for_repository(self, repository_id, proxy):
"""Gets a composition search session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearch... | python | def get_composition_search_session_for_repository(self, repository_id, proxy):
"""Gets a composition search session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearch... | [
"def",
"get_composition_search_session_for_repository",
"(",
"self",
",",
"repository_id",
",",
"proxy",
")",
":",
"if",
"repository_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"not",
"self",
".",
"supports_composition_search",
"(",
")",
"or",... | Gets a composition search session for the given repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSearchSession) - a
CompositionSearchSession
raise: NotFound - repositor... | [
"Gets",
"a",
"composition",
"search",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2728-L2758 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_notification_session_for_repository | def get_composition_notification_session_for_repository(self, composition_receiver, repository_id, proxy):
"""Gets the composition notification session for the given
repository.
arg: composition_receiver
(osid.repository.CompositionReceiver): the notification
... | python | def get_composition_notification_session_for_repository(self, composition_receiver, repository_id, proxy):
"""Gets the composition notification session for the given
repository.
arg: composition_receiver
(osid.repository.CompositionReceiver): the notification
... | [
"def",
"get_composition_notification_session_for_repository",
"(",
"self",
",",
"composition_receiver",
",",
"repository_id",
",",
"proxy",
")",
":",
"if",
"composition_receiver",
"is",
"None",
"or",
"repository_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")... | Gets the composition notification session for the given
repository.
arg: composition_receiver
(osid.repository.CompositionReceiver): the notification
callback
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy)... | [
"Gets",
"the",
"composition",
"notification",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2852-L2890 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_repository_session | def get_composition_repository_session(self, proxy):
"""Gets the session for retrieving composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositorySession) - a
CompositionRepositorySession
raise: O... | python | def get_composition_repository_session(self, proxy):
"""Gets the session for retrieving composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositorySession) - a
CompositionRepositorySession
raise: O... | [
"def",
"get_composition_repository_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_composition_repository",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"import",
"sessions",
"except",
"ImportErro... | Gets the session for retrieving composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositorySession) - a
CompositionRepositorySession
raise: OperationFailed - unable to complete request
raise: Unim... | [
"Gets",
"the",
"session",
"for",
"retrieving",
"composition",
"to",
"repository",
"mappings",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2892-L2917 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_repository_assignment_session | def get_composition_repository_assignment_session(self, proxy):
"""Gets the session for assigning composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositoryAssignmentSession)
- a CompositionRepositoryAssig... | python | def get_composition_repository_assignment_session(self, proxy):
"""Gets the session for assigning composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositoryAssignmentSession)
- a CompositionRepositoryAssig... | [
"def",
"get_composition_repository_assignment_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_composition_repository_assignment",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"import",
"sessions",
"... | Gets the session for assigning composition to repository
mappings.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionRepositoryAssignmentSession)
- a CompositionRepositoryAssignmentSession
raise: OperationFailed - unable to complete request
... | [
"Gets",
"the",
"session",
"for",
"assigning",
"composition",
"to",
"repository",
"mappings",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2919-L2945 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_composition_smart_repository_session | def get_composition_smart_repository_session(self, repository_id, proxy):
"""Gets a composition smart repository session for the given
repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.Comp... | python | def get_composition_smart_repository_session(self, repository_id, proxy):
"""Gets a composition smart repository session for the given
repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.Comp... | [
"def",
"get_composition_smart_repository_session",
"(",
"self",
",",
"repository_id",
",",
"proxy",
")",
":",
"if",
"repository_id",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"not",
"self",
".",
"supports_composition_smart_repository",
"(",
")",
... | Gets a composition smart repository session for the given
repository.
arg: repository_id (osid.id.Id): the Id of the repository
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.CompositionSmartRepositorySession) - a
CompositionSmartRepositorySession
... | [
"Gets",
"a",
"composition",
"smart",
"repository",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2947-L2977 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_repository_lookup_session | def get_repository_lookup_session(self, proxy, *args, **kwargs):
"""Gets the repository lookup session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryLookupSession) - a
RepositoryLookupSession
raise: OperationFailed - unable to complete re... | python | def get_repository_lookup_session(self, proxy, *args, **kwargs):
"""Gets the repository lookup session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryLookupSession) - a
RepositoryLookupSession
raise: OperationFailed - unable to complete re... | [
"def",
"get_repository_lookup_session",
"(",
"self",
",",
"proxy",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"supports_repository_lookup",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"i... | Gets the repository lookup session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryLookupSession) - a
RepositoryLookupSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_repository_lookup() is false
... | [
"Gets",
"the",
"repository",
"lookup",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L2979-L3002 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_repository_notification_session | def get_repository_notification_session(self, repository_receiver, proxy):
"""Gets the notification session for subscribing to changes to a
repository.
arg: repository_receiver
(osid.repository.RepositoryReceiver): the notification
callback
arg pro... | python | def get_repository_notification_session(self, repository_receiver, proxy):
"""Gets the notification session for subscribing to changes to a
repository.
arg: repository_receiver
(osid.repository.RepositoryReceiver): the notification
callback
arg pro... | [
"def",
"get_repository_notification_session",
"(",
"self",
",",
"repository_receiver",
",",
"proxy",
")",
":",
"if",
"repository_receiver",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"not",
"self",
".",
"supports_repository_notification",
"(",
")",
... | Gets the notification session for subscribing to changes to a
repository.
arg: repository_receiver
(osid.repository.RepositoryReceiver): the notification
callback
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryNotification... | [
"Gets",
"the",
"notification",
"session",
"for",
"subscribing",
"to",
"changes",
"to",
"a",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L3080-L3111 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_repository_hierarchy_session | def get_repository_hierarchy_session(self, proxy):
"""Gets the repository hierarchy traversal session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchySession) - a
RepositoryHierarchySession
raise: OperationFailed - unable to comple... | python | def get_repository_hierarchy_session(self, proxy):
"""Gets the repository hierarchy traversal session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchySession) - a
RepositoryHierarchySession
raise: OperationFailed - unable to comple... | [
"def",
"get_repository_hierarchy_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_repository_hierarchy",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"import",
"sessions",
"except",
"ImportError",
... | Gets the repository hierarchy traversal session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchySession) - a
RepositoryHierarchySession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_repository... | [
"Gets",
"the",
"repository",
"hierarchy",
"traversal",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L3113-L3136 |
mitsei/dlkit | dlkit/handcar/repository/managers.py | RepositoryProxyManager.get_repository_hierarchy_design_session | def get_repository_hierarchy_design_session(self, proxy):
"""Gets the repository hierarchy design session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchyDesignSession) - a
RepostoryHierarchyDesignSession
raise: OperationFailed - u... | python | def get_repository_hierarchy_design_session(self, proxy):
"""Gets the repository hierarchy design session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchyDesignSession) - a
RepostoryHierarchyDesignSession
raise: OperationFailed - u... | [
"def",
"get_repository_hierarchy_design_session",
"(",
"self",
",",
"proxy",
")",
":",
"if",
"not",
"self",
".",
"supports_repository_hierarchy_design",
"(",
")",
":",
"raise",
"Unimplemented",
"(",
")",
"try",
":",
"from",
".",
"import",
"sessions",
"except",
"... | Gets the repository hierarchy design session.
arg proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.RepositoryHierarchyDesignSession) - a
RepostoryHierarchyDesignSession
raise: OperationFailed - unable to complete request
raise: Unimplemented - supports_re... | [
"Gets",
"the",
"repository",
"hierarchy",
"design",
"session",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/repository/managers.py#L3138-L3162 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryManager.get_asset_content_lookup_session_for_repository | def get_asset_content_lookup_session_for_repository(self, repository_id=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service for
the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetLookupSess... | python | def get_asset_content_lookup_session_for_repository(self, repository_id=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service for
the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetLookupSess... | [
"def",
"get_asset_content_lookup_session_for_repository",
"(",
"self",
",",
"repository_id",
"=",
"None",
")",
":",
"return",
"AssetContentLookupSession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_content_lookup_session_for_repository",
"(",
"repository_id",
")",... | Gets the ``OsidSession`` associated with the asset content lookup service for
the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetLookupSession) - the new
``AssetLookupSession``
raise: NotFound - ``reposit... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"asset",
"content",
"lookup",
"service",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L714-L733 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryManager.get_asset_query_session_for_repository | def get_asset_query_session_for_repository(self, repository_id=None):
"""Gets an asset query session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: ... | python | def get_asset_query_session_for_repository(self, repository_id=None):
"""Gets an asset query session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: ... | [
"def",
"get_asset_query_session_for_repository",
"(",
"self",
",",
"repository_id",
"=",
"None",
")",
":",
"return",
"AssetQuerySession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_query_session_for_repository",
"(",
"repository_id",
")",
",",
"self",
".",
... | Gets an asset query session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: NotFound - ``repository_id`` not found
raise: NullArgument - ``repositor... | [
"Gets",
"an",
"asset",
"query",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L753-L771 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_lookup_session | def get_asset_lookup_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset lookup service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetLookupSession) - an
``AssetLookupSession``
raise: NullArgument - ``proxy`` is ``... | python | def get_asset_lookup_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset lookup service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetLookupSession) - an
``AssetLookupSession``
raise: NullArgument - ``proxy`` is ``... | [
"def",
"get_asset_lookup_session",
"(",
"self",
",",
"proxy",
"=",
"None",
")",
":",
"return",
"AssetLookupSession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_lookup_session",
"(",
"proxy",
")",
",",
"self",
".",
"_config_map",
")"
] | Gets the ``OsidSession`` associated with the asset lookup service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetLookupSession) - an
``AssetLookupSession``
raise: NullArgument - ``proxy`` is ``null``
raise: OperationFailed - unable to complete... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"asset",
"lookup",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1691-L1705 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_lookup_session_for_repository | def get_asset_lookup_session_for_repository(self, repository_id=None, proxy=None):
"""Gets the ``OsidSession`` associated with the asset lookup service for the
given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
... | python | def get_asset_lookup_session_for_repository(self, repository_id=None, proxy=None):
"""Gets the ``OsidSession`` associated with the asset lookup service for the
given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
... | [
"def",
"get_asset_lookup_session_for_repository",
"(",
"self",
",",
"repository_id",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"return",
"AssetLookupSession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_lookup_session_for_repository",
"(",
"repository... | Gets the ``OsidSession`` associated with the asset lookup service for the
given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetLookupSession) - an
``AssetLookupSession``... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"asset",
"lookup",
"service",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1707-L1729 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_content_lookup_session | def get_asset_content_lookup_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service.
return: (osid.repository.AssetLookupSession) - the new
``AssetLookupSession``
raise: OperationFailed - unable to complete request
raise:... | python | def get_asset_content_lookup_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset content lookup service.
return: (osid.repository.AssetLookupSession) - the new
``AssetLookupSession``
raise: OperationFailed - unable to complete request
raise:... | [
"def",
"get_asset_content_lookup_session",
"(",
"self",
",",
"proxy",
"=",
"None",
")",
":",
"return",
"AssetContentLookupSession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_content_lookup_session",
"(",
"proxy",
")",
",",
"self",
".",
"_config_map",
")... | Gets the ``OsidSession`` associated with the asset content lookup service.
return: (osid.repository.AssetLookupSession) - the new
``AssetLookupSession``
raise: OperationFailed - unable to complete request
raise: Unimplemented - ``supports_asset_lookup()`` is ``false``
... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"asset",
"content",
"lookup",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1731-L1743 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_query_session | def get_asset_query_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: NullArgument - ``proxy`` is ``null... | python | def get_asset_query_session(self, proxy=None):
"""Gets the ``OsidSession`` associated with the asset query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: NullArgument - ``proxy`` is ``null... | [
"def",
"get_asset_query_session",
"(",
"self",
",",
"proxy",
"=",
"None",
")",
":",
"return",
"AssetQuerySession",
"(",
"self",
".",
"_provider_manager",
".",
"get_asset_query_session",
"(",
"proxy",
")",
",",
"self",
".",
"_config_map",
")"
] | Gets the ``OsidSession`` associated with the asset query service.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetQuerySession) - an
``AssetQuerySession``
raise: NullArgument - ``proxy`` is ``null``
raise: OperationFailed - unable to complete re... | [
"Gets",
"the",
"OsidSession",
"associated",
"with",
"the",
"asset",
"query",
"service",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1769-L1784 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_admin_session | def get_asset_admin_session(self, proxy=None):
"""Gets an asset administration session for creating, updating and deleting assets.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAdminSession) - an
``AssetAdminSession``
raise: NullArgument - ``pr... | python | def get_asset_admin_session(self, proxy=None):
"""Gets an asset administration session for creating, updating and deleting assets.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAdminSession) - an
``AssetAdminSession``
raise: NullArgument - ``pr... | [
"def",
"get_asset_admin_session",
"(",
"self",
",",
"proxy",
"=",
"None",
")",
":",
"asset_lookup_session",
"=",
"self",
".",
"_provider_manager",
".",
"get_asset_lookup_session",
"(",
"proxy",
")",
"return",
"AssetAdminSession",
"(",
"self",
".",
"_provider_manager... | Gets an asset administration session for creating, updating and deleting assets.
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAdminSession) - an
``AssetAdminSession``
raise: NullArgument - ``proxy`` is ``null``
raise: OperationFailed - unable... | [
"Gets",
"an",
"asset",
"administration",
"session",
"for",
"creating",
"updating",
"and",
"deleting",
"assets",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1846-L1863 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_admin_session_for_repository | def get_asset_admin_session_for_repository(self, repository_id=None, proxy=None):
"""Gets an asset administration session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAd... | python | def get_asset_admin_session_for_repository(self, repository_id=None, proxy=None):
"""Gets an asset administration session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAd... | [
"def",
"get_asset_admin_session_for_repository",
"(",
"self",
",",
"repository_id",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"asset_lookup_session",
"=",
"self",
".",
"_provider_manager",
".",
"get_asset_lookup_session_for_repository",
"(",
"repository_id",
","... | Gets an asset administration session for the given repository.
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.repository.AssetAdminSession) - an
``AssetAdminSession``
raise: NotFound - ``repositor... | [
"Gets",
"an",
"asset",
"administration",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1865-L1889 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_asset_notification_session_for_repository | def get_asset_notification_session_for_repository(self,
asset_receiver=None,
repository_id=None,
proxy=None):
"""Gets the asset notification session f... | python | def get_asset_notification_session_for_repository(self,
asset_receiver=None,
repository_id=None,
proxy=None):
"""Gets the asset notification session f... | [
"def",
"get_asset_notification_session_for_repository",
"(",
"self",
",",
"asset_receiver",
"=",
"None",
",",
"repository_id",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"# Implemented from awsosid template for -",
"# osid.resource.ResourceManager.get_resource_lookup_ses... | Gets the asset notification session for the given repository.
arg: asset_receiver (osid.repository.AssetReceiver): the
notification callback
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a proxy
return: (osid.reposi... | [
"Gets",
"the",
"asset",
"notification",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L1913-L1941 |
mitsei/dlkit | dlkit/aws_adapter/repository/managers.py | RepositoryProxyManager.get_composition_notification_session_for_repository | def get_composition_notification_session_for_repository(self,
composition_receiver=None,
repository_id=None,
proxy=None):
"""Gets th... | python | def get_composition_notification_session_for_repository(self,
composition_receiver=None,
repository_id=None,
proxy=None):
"""Gets th... | [
"def",
"get_composition_notification_session_for_repository",
"(",
"self",
",",
"composition_receiver",
"=",
"None",
",",
"repository_id",
"=",
"None",
",",
"proxy",
"=",
"None",
")",
":",
"# Implemented from awsosid template for -",
"# osid.resource.ResourceManager.get_resourc... | Gets the composition notification session for the given repository.
arg: composition_receiver
(osid.repository.CompositionReceiver): the notification
callback
arg: repository_id (osid.id.Id): the ``Id`` of the repository
arg: proxy (osid.proxy.Proxy): a ... | [
"Gets",
"the",
"composition",
"notification",
"session",
"for",
"the",
"given",
"repository",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/aws_adapter/repository/managers.py#L2427-L2455 |
jason-weirather/py-seq-tools | seqtools/quantification.py | TPMCalculator.calculate | def calculate(self):
"""do the TPM calculation"""
self._calculated = True
for name in self.transcripts:
self.transcripts[name]['RPK'] = (float(self.transcripts[name]['count'])/float(self.transcripts[name]['length']))/float(1000)
tot = 0.0
for name in self.transcripts:
tot... | python | def calculate(self):
"""do the TPM calculation"""
self._calculated = True
for name in self.transcripts:
self.transcripts[name]['RPK'] = (float(self.transcripts[name]['count'])/float(self.transcripts[name]['length']))/float(1000)
tot = 0.0
for name in self.transcripts:
tot... | [
"def",
"calculate",
"(",
"self",
")",
":",
"self",
".",
"_calculated",
"=",
"True",
"for",
"name",
"in",
"self",
".",
"transcripts",
":",
"self",
".",
"transcripts",
"[",
"name",
"]",
"[",
"'RPK'",
"]",
"=",
"(",
"float",
"(",
"self",
".",
"transcrip... | do the TPM calculation | [
"do",
"the",
"TPM",
"calculation"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/quantification.py#L22-L40 |
mitsei/dlkit | dlkit/filesystem_adapter/osid/managers.py | OsidProfile._initialize | def _initialize(self, runtime):
"""Common initializer for OsidManager and OsidProxyManager"""
if runtime is None:
raise NullArgument()
if self._my_runtime is not None:
raise IllegalState('this manager has already been initialized.')
self._my_runtime = runtime
... | python | def _initialize(self, runtime):
"""Common initializer for OsidManager and OsidProxyManager"""
if runtime is None:
raise NullArgument()
if self._my_runtime is not None:
raise IllegalState('this manager has already been initialized.')
self._my_runtime = runtime
... | [
"def",
"_initialize",
"(",
"self",
",",
"runtime",
")",
":",
"if",
"runtime",
"is",
"None",
":",
"raise",
"NullArgument",
"(",
")",
"if",
"self",
".",
"_my_runtime",
"is",
"not",
"None",
":",
"raise",
"IllegalState",
"(",
"'this manager has already been initia... | Common initializer for OsidManager and OsidProxyManager | [
"Common",
"initializer",
"for",
"OsidManager",
"and",
"OsidProxyManager"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/filesystem_adapter/osid/managers.py#L24-L65 |
njharman/die | die/die.py | Die.tuple_roll | def tuple_roll(self, count=0):
'''One or more die rolls.
:param count: [0] Return list of ``count`` rolls
:return: (face, value) of roll or list of same
'''
if count:
return [self._faces[random.randint(1, self._sides) - 1] for i in range(count)]
else:
... | python | def tuple_roll(self, count=0):
'''One or more die rolls.
:param count: [0] Return list of ``count`` rolls
:return: (face, value) of roll or list of same
'''
if count:
return [self._faces[random.randint(1, self._sides) - 1] for i in range(count)]
else:
... | [
"def",
"tuple_roll",
"(",
"self",
",",
"count",
"=",
"0",
")",
":",
"if",
"count",
":",
"return",
"[",
"self",
".",
"_faces",
"[",
"random",
".",
"randint",
"(",
"1",
",",
"self",
".",
"_sides",
")",
"-",
"1",
"]",
"for",
"i",
"in",
"range",
"(... | One or more die rolls.
:param count: [0] Return list of ``count`` rolls
:return: (face, value) of roll or list of same | [
"One",
"or",
"more",
"die",
"rolls",
".",
":",
"param",
"count",
":",
"[",
"0",
"]",
"Return",
"list",
"of",
"count",
"rolls",
":",
"return",
":",
"(",
"face",
"value",
")",
"of",
"roll",
"or",
"list",
"of",
"same"
] | train | https://github.com/njharman/die/blob/ad6b837fcf2415d1a7c7283f3b333ad435d0821d/die/die.py#L173-L181 |
mitsei/dlkit | dlkit/records/assessment/edx/multi_choice_records.py | edXMultiChoiceQuestionFormRecord._init_map | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['rerandomize'] = \
self._rerandomize_metadata['default_object_values'][0]
super(edXMultiChoiceQuestionFormRecord, self)._init_map() | python | def _init_map(self):
"""stub"""
self.my_osid_object_form._my_map['rerandomize'] = \
self._rerandomize_metadata['default_object_values'][0]
super(edXMultiChoiceQuestionFormRecord, self)._init_map() | [
"def",
"_init_map",
"(",
"self",
")",
":",
"self",
".",
"my_osid_object_form",
".",
"_my_map",
"[",
"'rerandomize'",
"]",
"=",
"self",
".",
"_rerandomize_metadata",
"[",
"'default_object_values'",
"]",
"[",
"0",
"]",
"super",
"(",
"edXMultiChoiceQuestionFormRecord... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/edx/multi_choice_records.py#L101-L105 |
mitsei/dlkit | dlkit/records/assessment/edx/multi_choice_records.py | edXMultiChoiceQuestionFormRecord._init_metadata | def _init_metadata(self):
"""stub"""
self._rerandomize_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'rerandomize'),
'element_label': 'Randomize',
'inst... | python | def _init_metadata(self):
"""stub"""
self._rerandomize_metadata = {
'element_id': Id(self.my_osid_object_form._authority,
self.my_osid_object_form._namespace,
'rerandomize'),
'element_label': 'Randomize',
'inst... | [
"def",
"_init_metadata",
"(",
"self",
")",
":",
"self",
".",
"_rerandomize_metadata",
"=",
"{",
"'element_id'",
":",
"Id",
"(",
"self",
".",
"my_osid_object_form",
".",
"_authority",
",",
"self",
".",
"my_osid_object_form",
".",
"_namespace",
",",
"'rerandomize'... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/edx/multi_choice_records.py#L107-L125 |
mitsei/dlkit | dlkit/records/assessment/edx/multi_choice_records.py | edXMultiChoiceQuestionFormRecord.add_rerandomize | def add_rerandomize(self, rerandomize):
"""stub"""
if not self.my_osid_object_form._is_valid_string(
rerandomize, self.get_rerandomize_metadata()):
raise InvalidArgument('rerandomize')
self.my_osid_object_form._my_map['rerandomize'] = rerandomize | python | def add_rerandomize(self, rerandomize):
"""stub"""
if not self.my_osid_object_form._is_valid_string(
rerandomize, self.get_rerandomize_metadata()):
raise InvalidArgument('rerandomize')
self.my_osid_object_form._my_map['rerandomize'] = rerandomize | [
"def",
"add_rerandomize",
"(",
"self",
",",
"rerandomize",
")",
":",
"if",
"not",
"self",
".",
"my_osid_object_form",
".",
"_is_valid_string",
"(",
"rerandomize",
",",
"self",
".",
"get_rerandomize_metadata",
"(",
")",
")",
":",
"raise",
"InvalidArgument",
"(",
... | stub | [
"stub"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/records/assessment/edx/multi_choice_records.py#L131-L136 |
mitsei/dlkit | dlkit/json_/learning/searches.py | ObjectiveSearchResults.get_objectives | def get_objectives(self):
"""Gets the objective list resulting from the search.
return: (osid.learning.ObjectiveList) - the objective list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | def get_objectives(self):
"""Gets the objective list resulting from the search.
return: (osid.learning.ObjectiveList) - the objective list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | [
"def",
"get_objectives",
"(",
"self",
")",
":",
"if",
"self",
".",
"retrieved",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'List has already been retrieved.'",
")",
"self",
".",
"retrieved",
"=",
"True",
"return",
"objects",
".",
"ObjectiveList",
"(",
... | Gets the objective list resulting from the search.
return: (osid.learning.ObjectiveList) - the objective list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"objective",
"list",
"resulting",
"from",
"the",
"search",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/searches.py#L97-L108 |
mitsei/dlkit | dlkit/json_/learning/searches.py | ActivitySearchResults.get_activities | def get_activities(self):
"""Gets the activity list resulting from the search.
return: (osid.learning.ActivityList) - the activity list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | python | def get_activities(self):
"""Gets the activity list resulting from the search.
return: (osid.learning.ActivityList) - the activity list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrieved:
... | [
"def",
"get_activities",
"(",
"self",
")",
":",
"if",
"self",
".",
"retrieved",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'List has already been retrieved.'",
")",
"self",
".",
"retrieved",
"=",
"True",
"return",
"objects",
".",
"ActivityList",
"(",
"... | Gets the activity list resulting from the search.
return: (osid.learning.ActivityList) - the activity list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"activity",
"list",
"resulting",
"from",
"the",
"search",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/searches.py#L221-L232 |
mitsei/dlkit | dlkit/json_/learning/searches.py | ProficiencySearchResults.get_proficiencies | def get_proficiencies(self):
"""Gets the proficiency list resulting from a search.
return: (osid.learning.ProficiencyList) - the proficiency list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrie... | python | def get_proficiencies(self):
"""Gets the proficiency list resulting from a search.
return: (osid.learning.ProficiencyList) - the proficiency list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
"""
if self.retrie... | [
"def",
"get_proficiencies",
"(",
"self",
")",
":",
"if",
"self",
".",
"retrieved",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'List has already been retrieved.'",
")",
"self",
".",
"retrieved",
"=",
"True",
"return",
"objects",
".",
"ProficiencyList",
"(... | Gets the proficiency list resulting from a search.
return: (osid.learning.ProficiencyList) - the proficiency list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"proficiency",
"list",
"resulting",
"from",
"a",
"search",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/searches.py#L345-L356 |
mitsei/dlkit | dlkit/json_/learning/searches.py | ObjectiveBankSearchResults.get_objective_banks | def get_objective_banks(self):
"""Gets the objective bank list resulting from the search.
return: (osid.learning.ObjectiveBankList) - the objective bank
list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
... | python | def get_objective_banks(self):
"""Gets the objective bank list resulting from the search.
return: (osid.learning.ObjectiveBankList) - the objective bank
list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.*
... | [
"def",
"get_objective_banks",
"(",
"self",
")",
":",
"if",
"self",
".",
"retrieved",
":",
"raise",
"errors",
".",
"IllegalState",
"(",
"'List has already been retrieved.'",
")",
"self",
".",
"retrieved",
"=",
"True",
"return",
"objects",
".",
"ObjectiveBankList",
... | Gets the objective bank list resulting from the search.
return: (osid.learning.ObjectiveBankList) - the objective bank
list
raise: IllegalState - list already retrieved
*compliance: mandatory -- This method must be implemented.* | [
"Gets",
"the",
"objective",
"bank",
"list",
"resulting",
"from",
"the",
"search",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/learning/searches.py#L470-L482 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager._set_bin_view | def _set_bin_view(self, session):
"""Sets the underlying bin view to match current view"""
if self._bin_view == COMPARATIVE:
try:
session.use_comparative_bin_view()
except AttributeError:
pass
else:
try:
session.... | python | def _set_bin_view(self, session):
"""Sets the underlying bin view to match current view"""
if self._bin_view == COMPARATIVE:
try:
session.use_comparative_bin_view()
except AttributeError:
pass
else:
try:
session.... | [
"def",
"_set_bin_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_bin_view",
"==",
"COMPARATIVE",
":",
"try",
":",
"session",
".",
"use_comparative_bin_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
"se... | Sets the underlying bin view to match current view | [
"Sets",
"the",
"underlying",
"bin",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L186-L197 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.initialize | def initialize(self, runtime):
"""OSID Manager initialize"""
from .primitives import Id
if self._runtime is not None:
raise IllegalState('Manager has already been initialized')
self._runtime = runtime
config = runtime.get_configuration()
parameter_id = Id('par... | python | def initialize(self, runtime):
"""OSID Manager initialize"""
from .primitives import Id
if self._runtime is not None:
raise IllegalState('Manager has already been initialized')
self._runtime = runtime
config = runtime.get_configuration()
parameter_id = Id('par... | [
"def",
"initialize",
"(",
"self",
",",
"runtime",
")",
":",
"from",
".",
"primitives",
"import",
"Id",
"if",
"self",
".",
"_runtime",
"is",
"not",
"None",
":",
"raise",
"IllegalState",
"(",
"'Manager has already been initialized'",
")",
"self",
".",
"_runtime"... | OSID Manager initialize | [
"OSID",
"Manager",
"initialize"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L264-L278 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.use_comparative_bin_view | def use_comparative_bin_view(self):
"""Pass through to provider ResourceBinSession.use_comparative_bin_view"""
self._bin_view = COMPARATIVE
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_comparative_bin_view(self):
"""Pass through to provider ResourceBinSession.use_comparative_bin_view"""
self._bin_view = COMPARATIVE
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_comparative_bin_view",
"(",
"self",
")",
":",
"self",
".",
"_bin_view",
"=",
"COMPARATIVE",
"# self._get_provider_session('resource_bin_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
... | Pass through to provider ResourceBinSession.use_comparative_bin_view | [
"Pass",
"through",
"to",
"provider",
"ResourceBinSession",
".",
"use_comparative_bin_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L464-L472 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.use_plenary_bin_view | def use_plenary_bin_view(self):
"""Pass through to provider ResourceBinSession.use_plenary_bin_view"""
self._bin_view = PLENARY
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | python | def use_plenary_bin_view(self):
"""Pass through to provider ResourceBinSession.use_plenary_bin_view"""
self._bin_view = PLENARY
# self._get_provider_session('resource_bin_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
try:
... | [
"def",
"use_plenary_bin_view",
"(",
"self",
")",
":",
"self",
".",
"_bin_view",
"=",
"PLENARY",
"# self._get_provider_session('resource_bin_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"try",... | Pass through to provider ResourceBinSession.use_plenary_bin_view | [
"Pass",
"through",
"to",
"provider",
"ResourceBinSession",
".",
"use_plenary_bin_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L474-L482 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.get_bins_by_resource | def get_bins_by_resource(self, *args, **kwargs):
"""Pass through to provider ResourceBinSession.get_bins_by_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('resource_bin_session').get_bins... | python | def get_bins_by_resource(self, *args, **kwargs):
"""Pass through to provider ResourceBinSession.get_bins_by_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceBinSession.get_bins_by_resource
catalogs = self._get_provider_session('resource_bin_session').get_bins... | [
"def",
"get_bins_by_resource",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceBinSession.get_bins_by_resource",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'resource_bi... | Pass through to provider ResourceBinSession.get_bins_by_resource | [
"Pass",
"through",
"to",
"provider",
"ResourceBinSession",
".",
"get_bins_by_resource"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L520-L528 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.get_bin | def get_bin(self, *args, **kwargs):
"""Pass through to provider BinLookupSession.get_bin"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bin
return Bin(
self._provider_manager,
self._get_provider_session('bin_lookup_session').get_... | python | def get_bin(self, *args, **kwargs):
"""Pass through to provider BinLookupSession.get_bin"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bin
return Bin(
self._provider_manager,
self._get_provider_session('bin_lookup_session').get_... | [
"def",
"get_bin",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bin",
"return",
"Bin",
"(",
"self",
".",
"_provider_manager",
",",
"self",
".",
"_get_provider_sessio... | Pass through to provider BinLookupSession.get_bin | [
"Pass",
"through",
"to",
"provider",
"BinLookupSession",
".",
"get_bin"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L576-L584 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.get_bins | def get_bins(self):
"""Pass through to provider BinLookupSession.get_bins"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('bin_lookup_session').get_bins()
cat_list = []
for cat in catalo... | python | def get_bins(self):
"""Pass through to provider BinLookupSession.get_bins"""
# Implemented from kitosid template for -
# osid.resource.BinLookupSession.get_bins_template
catalogs = self._get_provider_session('bin_lookup_session').get_bins()
cat_list = []
for cat in catalo... | [
"def",
"get_bins",
"(",
"self",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinLookupSession.get_bins_template",
"catalogs",
"=",
"self",
".",
"_get_provider_session",
"(",
"'bin_lookup_session'",
")",
".",
"get_bins",
"(",
")",
"cat_list",
"=",
... | Pass through to provider BinLookupSession.get_bins | [
"Pass",
"through",
"to",
"provider",
"BinLookupSession",
".",
"get_bins"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L636-L644 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.get_bin_form | def get_bin_form(self, *args, **kwargs):
"""Pass through to provider BinAdminSession.get_bin_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if isin... | python | def get_bin_form(self, *args, **kwargs):
"""Pass through to provider BinAdminSession.get_bin_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.get_bin_form_for_update_template
# This method might be a bit sketchy. Time will tell.
if isin... | [
"def",
"get_bin_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.get_bin_form_for_update_template",
"# This method might be a bit sketchy. Time will tell.",
"if",
"isinstance",
"... | Pass through to provider BinAdminSession.get_bin_form_for_update | [
"Pass",
"through",
"to",
"provider",
"BinAdminSession",
".",
"get_bin_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L712-L720 |
mitsei/dlkit | dlkit/services/resource.py | ResourceManager.save_bin | def save_bin(self, bin_form, *args, **kwargs):
"""Pass through to provider BinAdminSession.update_bin"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if bin_form.is_for_update():
return self.update_bin(bin_form, *args, **kwargs)
... | python | def save_bin(self, bin_form, *args, **kwargs):
"""Pass through to provider BinAdminSession.update_bin"""
# Implemented from kitosid template for -
# osid.resource.BinAdminSession.update_bin
if bin_form.is_for_update():
return self.update_bin(bin_form, *args, **kwargs)
... | [
"def",
"save_bin",
"(",
"self",
",",
"bin_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.BinAdminSession.update_bin",
"if",
"bin_form",
".",
"is_for_update",
"(",
")",
":",
"return",
"self",
... | Pass through to provider BinAdminSession.update_bin | [
"Pass",
"through",
"to",
"provider",
"BinAdminSession",
".",
"update_bin"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L733-L740 |
mitsei/dlkit | dlkit/services/resource.py | Bin._set_bin_view | def _set_bin_view(self, session):
"""Sets the underlying bin view to match current view"""
if self._bin_view == FEDERATED:
try:
session.use_federated_bin_view()
except AttributeError:
pass
else:
try:
session.use_... | python | def _set_bin_view(self, session):
"""Sets the underlying bin view to match current view"""
if self._bin_view == FEDERATED:
try:
session.use_federated_bin_view()
except AttributeError:
pass
else:
try:
session.use_... | [
"def",
"_set_bin_view",
"(",
"self",
",",
"session",
")",
":",
"if",
"self",
".",
"_bin_view",
"==",
"FEDERATED",
":",
"try",
":",
"session",
".",
"use_federated_bin_view",
"(",
")",
"except",
"AttributeError",
":",
"pass",
"else",
":",
"try",
":",
"sessio... | Sets the underlying bin view to match current view | [
"Sets",
"the",
"underlying",
"bin",
"view",
"to",
"match",
"current",
"view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1062-L1073 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_comparative_resource_view | def use_comparative_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_comparative_resource_view"""
self._object_views['resource'] = COMPARATIVE
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_... | python | def use_comparative_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_comparative_resource_view"""
self._object_views['resource'] = COMPARATIVE
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_... | [
"def",
"use_comparative_resource_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'resource'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get... | Pass through to provider ResourceLookupSession.use_comparative_resource_view | [
"Pass",
"through",
"to",
"provider",
"ResourceLookupSession",
".",
"use_comparative_resource_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1197-L1205 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_plenary_resource_view | def use_plenary_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_plenary_resource_view"""
self._object_views['resource'] = PLENARY
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_ses... | python | def use_plenary_resource_view(self):
"""Pass through to provider ResourceLookupSession.use_plenary_resource_view"""
self._object_views['resource'] = PLENARY
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_ses... | [
"def",
"use_plenary_resource_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'resource'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provide... | Pass through to provider ResourceLookupSession.use_plenary_resource_view | [
"Pass",
"through",
"to",
"provider",
"ResourceLookupSession",
".",
"use_plenary_resource_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1207-L1215 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_federated_bin_view | def use_federated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_federated_bin_view"""
self._bin_view = FEDERATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_federated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_federated_bin_view"""
self._bin_view = FEDERATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_federated_bin_view",
"(",
"self",
")",
":",
"self",
".",
"_bin_view",
"=",
"FEDERATED",
"# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
... | Pass through to provider ResourceLookupSession.use_federated_bin_view | [
"Pass",
"through",
"to",
"provider",
"ResourceLookupSession",
".",
"use_federated_bin_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1217-L1225 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_isolated_bin_view | def use_isolated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_isolated_bin_view"""
self._bin_view = ISOLATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
tr... | python | def use_isolated_bin_view(self):
"""Pass through to provider ResourceLookupSession.use_isolated_bin_view"""
self._bin_view = ISOLATED
# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
tr... | [
"def",
"use_isolated_bin_view",
"(",
"self",
")",
":",
"self",
".",
"_bin_view",
"=",
"ISOLATED",
"# self._get_provider_session('resource_lookup_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessions",
"(",
")",
":",
"... | Pass through to provider ResourceLookupSession.use_isolated_bin_view | [
"Pass",
"through",
"to",
"provider",
"ResourceLookupSession",
".",
"use_isolated_bin_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1227-L1235 |
mitsei/dlkit | dlkit/services/resource.py | Bin.get_resource_form | def get_resource_form(self, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.get_resource_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. Time will tell.... | python | def get_resource_form(self, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.get_resource_form_for_update"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.get_resource_form_for_update
# This method might be a bit sketchy. Time will tell.... | [
"def",
"get_resource_form",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.get_resource_form_for_update",
"# This method might be a bit sketchy. Time will tell.",
"if",
"isinstance... | Pass through to provider ResourceAdminSession.get_resource_form_for_update | [
"Pass",
"through",
"to",
"provider",
"ResourceAdminSession",
".",
"get_resource_form_for_update"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1361-L1369 |
mitsei/dlkit | dlkit/services/resource.py | Bin.save_resource | def save_resource(self, resource_form, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.update_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if resource_form.is_for_update():
return self.update_res... | python | def save_resource(self, resource_form, *args, **kwargs):
"""Pass through to provider ResourceAdminSession.update_resource"""
# Implemented from kitosid template for -
# osid.resource.ResourceAdminSession.update_resource
if resource_form.is_for_update():
return self.update_res... | [
"def",
"save_resource",
"(",
"self",
",",
"resource_form",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Implemented from kitosid template for -",
"# osid.resource.ResourceAdminSession.update_resource",
"if",
"resource_form",
".",
"is_for_update",
"(",
")",
":... | Pass through to provider ResourceAdminSession.update_resource | [
"Pass",
"through",
"to",
"provider",
"ResourceAdminSession",
".",
"update_resource"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1383-L1390 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_comparative_agent_view | def use_comparative_agent_view(self):
"""Pass through to provider ResourceAgentSession.use_comparative_agent_view"""
self._object_views['agent'] = COMPARATIVE
# self._get_provider_session('resource_agent_session') # To make sure the session is tracked
for session in self._get_provider_se... | python | def use_comparative_agent_view(self):
"""Pass through to provider ResourceAgentSession.use_comparative_agent_view"""
self._object_views['agent'] = COMPARATIVE
# self._get_provider_session('resource_agent_session') # To make sure the session is tracked
for session in self._get_provider_se... | [
"def",
"use_comparative_agent_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'agent'",
"]",
"=",
"COMPARATIVE",
"# self._get_provider_session('resource_agent_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provid... | Pass through to provider ResourceAgentSession.use_comparative_agent_view | [
"Pass",
"through",
"to",
"provider",
"ResourceAgentSession",
".",
"use_comparative_agent_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1462-L1470 |
mitsei/dlkit | dlkit/services/resource.py | Bin.use_plenary_agent_view | def use_plenary_agent_view(self):
"""Pass through to provider ResourceAgentSession.use_plenary_agent_view"""
self._object_views['agent'] = PLENARY
# self._get_provider_session('resource_agent_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | python | def use_plenary_agent_view(self):
"""Pass through to provider ResourceAgentSession.use_plenary_agent_view"""
self._object_views['agent'] = PLENARY
# self._get_provider_session('resource_agent_session') # To make sure the session is tracked
for session in self._get_provider_sessions():
... | [
"def",
"use_plenary_agent_view",
"(",
"self",
")",
":",
"self",
".",
"_object_views",
"[",
"'agent'",
"]",
"=",
"PLENARY",
"# self._get_provider_session('resource_agent_session') # To make sure the session is tracked",
"for",
"session",
"in",
"self",
".",
"_get_provider_sessi... | Pass through to provider ResourceAgentSession.use_plenary_agent_view | [
"Pass",
"through",
"to",
"provider",
"ResourceAgentSession",
".",
"use_plenary_agent_view"
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/services/resource.py#L1472-L1480 |
HDI-Project/mit-d3m | mit_d3m/utils.py | disk_usage | def disk_usage(path, human=False):
"""disk usage in bytes or human readable format (e.g. '2,1GB')"""
command = ['du', '-s', path]
if human:
command.append('-h')
return subprocess.check_output(command).split()[0].decode('utf-8') | python | def disk_usage(path, human=False):
"""disk usage in bytes or human readable format (e.g. '2,1GB')"""
command = ['du', '-s', path]
if human:
command.append('-h')
return subprocess.check_output(command).split()[0].decode('utf-8') | [
"def",
"disk_usage",
"(",
"path",
",",
"human",
"=",
"False",
")",
":",
"command",
"=",
"[",
"'du'",
",",
"'-s'",
",",
"path",
"]",
"if",
"human",
":",
"command",
".",
"append",
"(",
"'-h'",
")",
"return",
"subprocess",
".",
"check_output",
"(",
"com... | disk usage in bytes or human readable format (e.g. '2,1GB') | [
"disk",
"usage",
"in",
"bytes",
"or",
"human",
"readable",
"format",
"(",
"e",
".",
"g",
".",
"2",
"1GB",
")"
] | train | https://github.com/HDI-Project/mit-d3m/blob/3ab44eb5db8de8e28a29ca4b695a7a4becf45275/mit_d3m/utils.py#L26-L32 |
nrcharles/caelum | caelum/gfs.py | _join | def _join(segments):
"""simply list by joining adjacent segments."""
new = []
start = segments[0][0]
end = segments[0][1]
for i in range(len(segments)-1):
if segments[i+1][0] != segments[i][1]:
new.append((start, end))
start = segments[i+1][0]
end = segments[i... | python | def _join(segments):
"""simply list by joining adjacent segments."""
new = []
start = segments[0][0]
end = segments[0][1]
for i in range(len(segments)-1):
if segments[i+1][0] != segments[i][1]:
new.append((start, end))
start = segments[i+1][0]
end = segments[i... | [
"def",
"_join",
"(",
"segments",
")",
":",
"new",
"=",
"[",
"]",
"start",
"=",
"segments",
"[",
"0",
"]",
"[",
"0",
"]",
"end",
"=",
"segments",
"[",
"0",
"]",
"[",
"1",
"]",
"for",
"i",
"in",
"range",
"(",
"len",
"(",
"segments",
")",
"-",
... | simply list by joining adjacent segments. | [
"simply",
"list",
"by",
"joining",
"adjacent",
"segments",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/gfs.py#L38-L49 |
nrcharles/caelum | caelum/gfs.py | _filter_messages | def _filter_messages(messages, products=None, levels=None):
"""filter messages for desired products and levels."""
if products is None:
products = []
if levels is None:
levels = []
segments = []
bounds = len(messages)
for i, message in enumerate(messages):
if (message[3] ... | python | def _filter_messages(messages, products=None, levels=None):
"""filter messages for desired products and levels."""
if products is None:
products = []
if levels is None:
levels = []
segments = []
bounds = len(messages)
for i, message in enumerate(messages):
if (message[3] ... | [
"def",
"_filter_messages",
"(",
"messages",
",",
"products",
"=",
"None",
",",
"levels",
"=",
"None",
")",
":",
"if",
"products",
"is",
"None",
":",
"products",
"=",
"[",
"]",
"if",
"levels",
"is",
"None",
":",
"levels",
"=",
"[",
"]",
"segments",
"=... | filter messages for desired products and levels. | [
"filter",
"messages",
"for",
"desired",
"products",
"and",
"levels",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/gfs.py#L52-L69 |
nrcharles/caelum | caelum/gfs.py | _download_segments | def _download_segments(filename, url, segments):
"""download segments into a single file."""
gribfile = open(filename, 'w')
for start, end in segments:
req = urllib2.Request(url)
req.add_header('User-Agent',
'caelum/0.1 +https://github.com/nrcharles/caelum')
if... | python | def _download_segments(filename, url, segments):
"""download segments into a single file."""
gribfile = open(filename, 'w')
for start, end in segments:
req = urllib2.Request(url)
req.add_header('User-Agent',
'caelum/0.1 +https://github.com/nrcharles/caelum')
if... | [
"def",
"_download_segments",
"(",
"filename",
",",
"url",
",",
"segments",
")",
":",
"gribfile",
"=",
"open",
"(",
"filename",
",",
"'w'",
")",
"for",
"start",
",",
"end",
"in",
"segments",
":",
"req",
"=",
"urllib2",
".",
"Request",
"(",
"url",
")",
... | download segments into a single file. | [
"download",
"segments",
"into",
"a",
"single",
"file",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/gfs.py#L72-L85 |
nrcharles/caelum | caelum/gfs.py | download | def download(timestamp, dataset, path=None, products=None,
levels=None, offset=0):
"""save GFS grib file to DATA_PATH.
Args:
dataset(function): naming convention function. eg. pgrb2
timestamp(datetime): ???
path(str): if None defaults to DATA_PATH
products(list): T... | python | def download(timestamp, dataset, path=None, products=None,
levels=None, offset=0):
"""save GFS grib file to DATA_PATH.
Args:
dataset(function): naming convention function. eg. pgrb2
timestamp(datetime): ???
path(str): if None defaults to DATA_PATH
products(list): T... | [
"def",
"download",
"(",
"timestamp",
",",
"dataset",
",",
"path",
"=",
"None",
",",
"products",
"=",
"None",
",",
"levels",
"=",
"None",
",",
"offset",
"=",
"0",
")",
":",
"if",
"path",
"is",
"None",
":",
"path",
"=",
"DATA_PATH",
"closest",
"=",
"... | save GFS grib file to DATA_PATH.
Args:
dataset(function): naming convention function. eg. pgrb2
timestamp(datetime): ???
path(str): if None defaults to DATA_PATH
products(list): TMP, etc. if None downloads all.
layers(list): surface, etc. if None downloads all.
offs... | [
"save",
"GFS",
"grib",
"file",
"to",
"DATA_PATH",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/gfs.py#L99-L123 |
nrcharles/caelum | caelum/gfs.py | message_index | def message_index(index_url):
"""get message index of components for urllib2.
Args:
url(string):
Returns:
list: messages
"""
idx = csv.reader(urllib2.urlopen(index_url), delimiter=':')
messages = []
for line in idx:
messages.append(line)
return messages | python | def message_index(index_url):
"""get message index of components for urllib2.
Args:
url(string):
Returns:
list: messages
"""
idx = csv.reader(urllib2.urlopen(index_url), delimiter=':')
messages = []
for line in idx:
messages.append(line)
return messages | [
"def",
"message_index",
"(",
"index_url",
")",
":",
"idx",
"=",
"csv",
".",
"reader",
"(",
"urllib2",
".",
"urlopen",
"(",
"index_url",
")",
",",
"delimiter",
"=",
"':'",
")",
"messages",
"=",
"[",
"]",
"for",
"line",
"in",
"idx",
":",
"messages",
".... | get message index of components for urllib2.
Args:
url(string):
Returns:
list: messages | [
"get",
"message",
"index",
"of",
"components",
"for",
"urllib2",
"."
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/gfs.py#L126-L139 |
Vagrants/blackbird | blackbird/utils/configread.py | is_dir | def is_dir(value):
"""
This function checks whether given path as argument exists.
:param str value: Assumed directory path
:rtype: str
:return: If given value is valid, retuning given value.
"""
value = os.path.expanduser(value)
value = os.path.expandvars(value)
value = os.path.absp... | python | def is_dir(value):
"""
This function checks whether given path as argument exists.
:param str value: Assumed directory path
:rtype: str
:return: If given value is valid, retuning given value.
"""
value = os.path.expanduser(value)
value = os.path.expandvars(value)
value = os.path.absp... | [
"def",
"is_dir",
"(",
"value",
")",
":",
"value",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"value",
")",
"value",
"=",
"os",
".",
"path",
".",
"expandvars",
"(",
"value",
")",
"value",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"value",
... | This function checks whether given path as argument exists.
:param str value: Assumed directory path
:rtype: str
:return: If given value is valid, retuning given value. | [
"This",
"function",
"checks",
"whether",
"given",
"path",
"as",
"argument",
"exists",
".",
":",
"param",
"str",
"value",
":",
"Assumed",
"directory",
"path",
":",
"rtype",
":",
"str",
":",
"return",
":",
"If",
"given",
"value",
"is",
"valid",
"retuning",
... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L584-L614 |
Vagrants/blackbird | blackbird/utils/configread.py | extend_is_dir | def extend_is_dir(value, minimum=None, maximum=None):
u"""
This function is extended is_dir().
This function was able to take ListType or StringType as argument.
"""
if isinstance(value, list):
return [is_dir(member)
for member in validate.is_list(value, minimum, maximum)]
... | python | def extend_is_dir(value, minimum=None, maximum=None):
u"""
This function is extended is_dir().
This function was able to take ListType or StringType as argument.
"""
if isinstance(value, list):
return [is_dir(member)
for member in validate.is_list(value, minimum, maximum)]
... | [
"def",
"extend_is_dir",
"(",
"value",
",",
"minimum",
"=",
"None",
",",
"maximum",
"=",
"None",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"list",
")",
":",
"return",
"[",
"is_dir",
"(",
"member",
")",
"for",
"member",
"in",
"validate",
".",
"i... | u"""
This function is extended is_dir().
This function was able to take ListType or StringType as argument. | [
"u",
"This",
"function",
"is",
"extended",
"is_dir",
"()",
".",
"This",
"function",
"was",
"able",
"to",
"take",
"ListType",
"or",
"StringType",
"as",
"argument",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L617-L628 |
Vagrants/blackbird | blackbird/utils/configread.py | is_log | def is_log(value):
"""
This function checks whether file path
that is specified at "log_file" option exists,
whether write permission to the file path.
Return the following value:
case1: exists path and write permission
is_log('/tmp')
'/tmp/hogehoge.log'
case2: non-exis... | python | def is_log(value):
"""
This function checks whether file path
that is specified at "log_file" option exists,
whether write permission to the file path.
Return the following value:
case1: exists path and write permission
is_log('/tmp')
'/tmp/hogehoge.log'
case2: non-exis... | [
"def",
"is_log",
"(",
"value",
")",
":",
"if",
"value",
".",
"lower",
"(",
")",
"==",
"'syslog'",
":",
"return",
"'syslog'",
"value",
"=",
"os",
".",
"path",
".",
"expanduser",
"(",
"value",
")",
"value",
"=",
"os",
".",
"path",
".",
"expandvars",
... | This function checks whether file path
that is specified at "log_file" option exists,
whether write permission to the file path.
Return the following value:
case1: exists path and write permission
is_log('/tmp')
'/tmp/hogehoge.log'
case2: non-exists path and write permission
... | [
"This",
"function",
"checks",
"whether",
"file",
"path",
"that",
"is",
"specified",
"at",
"log_file",
"option",
"exists",
"whether",
"write",
"permission",
"to",
"the",
"file",
"path",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L631-L732 |
Vagrants/blackbird | blackbird/utils/configread.py | is_log_level | def is_log_level(value):
u"""
Check whether the value as argument be included the following list.
['debug', 'info', 'warn', 'error', 'crit']
"""
log_levels = ['debug', 'info', 'warn', 'error', 'crit']
if value in log_levels:
return value
else:
err_message = ('"log_level" s... | python | def is_log_level(value):
u"""
Check whether the value as argument be included the following list.
['debug', 'info', 'warn', 'error', 'crit']
"""
log_levels = ['debug', 'info', 'warn', 'error', 'crit']
if value in log_levels:
return value
else:
err_message = ('"log_level" s... | [
"def",
"is_log_level",
"(",
"value",
")",
":",
"log_levels",
"=",
"[",
"'debug'",
",",
"'info'",
",",
"'warn'",
",",
"'error'",
",",
"'crit'",
"]",
"if",
"value",
"in",
"log_levels",
":",
"return",
"value",
"else",
":",
"err_message",
"=",
"(",
"'\"log_l... | u"""
Check whether the value as argument be included the following list.
['debug', 'info', 'warn', 'error', 'crit'] | [
"u",
"Check",
"whether",
"the",
"value",
"as",
"argument",
"be",
"included",
"the",
"following",
"list",
".",
"[",
"debug",
"info",
"warn",
"error",
"crit",
"]"
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L735-L750 |
Vagrants/blackbird | blackbird/utils/configread.py | is_log_format | def is_log_format(value):
u"""
Check whether the value as argument be included the following list.
['ltsv', 'combined']
"""
log_levels = ['ltsv', 'combined']
if value in log_levels:
return value
else:
err_message = ('"log_format" supported following value: '
... | python | def is_log_format(value):
u"""
Check whether the value as argument be included the following list.
['ltsv', 'combined']
"""
log_levels = ['ltsv', 'combined']
if value in log_levels:
return value
else:
err_message = ('"log_format" supported following value: '
... | [
"def",
"is_log_format",
"(",
"value",
")",
":",
"log_levels",
"=",
"[",
"'ltsv'",
",",
"'combined'",
"]",
"if",
"value",
"in",
"log_levels",
":",
"return",
"value",
"else",
":",
"err_message",
"=",
"(",
"'\"log_format\" supported following value: '",
"'{0}'",
".... | u"""
Check whether the value as argument be included the following list.
['ltsv', 'combined'] | [
"u",
"Check",
"whether",
"the",
"value",
"as",
"argument",
"be",
"included",
"the",
"following",
"list",
".",
"[",
"ltsv",
"combined",
"]"
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L753-L768 |
Vagrants/blackbird | blackbird/utils/configread.py | is_user | def is_user(value, min=None, max=None):
"""
Check whether username or uid as argument exists.
if this function recieved username, convert uid and exec validation.
"""
if type(value) == str:
try:
entry = pwd.getpwnam(value)
value = entry.pw_uid
except KeyError... | python | def is_user(value, min=None, max=None):
"""
Check whether username or uid as argument exists.
if this function recieved username, convert uid and exec validation.
"""
if type(value) == str:
try:
entry = pwd.getpwnam(value)
value = entry.pw_uid
except KeyError... | [
"def",
"is_user",
"(",
"value",
",",
"min",
"=",
"None",
",",
"max",
"=",
"None",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"str",
":",
"try",
":",
"entry",
"=",
"pwd",
".",
"getpwnam",
"(",
"value",
")",
"value",
"=",
"entry",
".",
"pw_... | Check whether username or uid as argument exists.
if this function recieved username, convert uid and exec validation. | [
"Check",
"whether",
"username",
"or",
"uid",
"as",
"argument",
"exists",
".",
"if",
"this",
"function",
"recieved",
"username",
"convert",
"uid",
"and",
"exec",
"validation",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L771-L798 |
Vagrants/blackbird | blackbird/utils/configread.py | is_group | def is_group(value):
"""
Check whether groupname or gid as argument exists.
if this function recieved groupname, convert gid and exec validation.
"""
if type(value) == str:
try:
entry = grp.getgrnam(value)
value = entry.gr_gid
except KeyError:
err... | python | def is_group(value):
"""
Check whether groupname or gid as argument exists.
if this function recieved groupname, convert gid and exec validation.
"""
if type(value) == str:
try:
entry = grp.getgrnam(value)
value = entry.gr_gid
except KeyError:
err... | [
"def",
"is_group",
"(",
"value",
")",
":",
"if",
"type",
"(",
"value",
")",
"==",
"str",
":",
"try",
":",
"entry",
"=",
"grp",
".",
"getgrnam",
"(",
"value",
")",
"value",
"=",
"entry",
".",
"gr_gid",
"except",
"KeyError",
":",
"err_message",
"=",
... | Check whether groupname or gid as argument exists.
if this function recieved groupname, convert gid and exec validation. | [
"Check",
"whether",
"groupname",
"or",
"gid",
"as",
"argument",
"exists",
".",
"if",
"this",
"function",
"recieved",
"groupname",
"convert",
"gid",
"and",
"exec",
"validation",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L801-L828 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._configobj_factory | def _configobj_factory(self,
infile,
raise_errors=True,
list_values=True,
file_error=True,
interpolation=False,
configspec=None,
st... | python | def _configobj_factory(self,
infile,
raise_errors=True,
list_values=True,
file_error=True,
interpolation=False,
configspec=None,
st... | [
"def",
"_configobj_factory",
"(",
"self",
",",
"infile",
",",
"raise_errors",
"=",
"True",
",",
"list_values",
"=",
"True",
",",
"file_error",
"=",
"True",
",",
"interpolation",
"=",
"False",
",",
"configspec",
"=",
"None",
",",
"stringify",
"=",
"True",
"... | Factory Method.
Create Configobj instance and register it to self.config.
This method also is used to create configspec instance.
Because configspec instance also is ConfigObj instance. | [
"Factory",
"Method",
".",
"Create",
"Configobj",
"instance",
"and",
"register",
"it",
"to",
"self",
".",
"config",
".",
"This",
"method",
"also",
"is",
"used",
"to",
"create",
"configspec",
"instance",
".",
"Because",
"configspec",
"instance",
"also",
"is",
... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L66-L91 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._get_global_include_abs_path | def _get_global_include_abs_path(self, path):
"""
Get a value after converting to absolute path.
Becoming different from other parameter,
validation of `include` parameter is complex.
Before other validation(at first) this method is called to merge to
one configuration.
... | python | def _get_global_include_abs_path(self, path):
"""
Get a value after converting to absolute path.
Becoming different from other parameter,
validation of `include` parameter is complex.
Before other validation(at first) this method is called to merge to
one configuration.
... | [
"def",
"_get_global_include_abs_path",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isabs",
"(",
"path",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"path",
")",
"if",
"os",
".",
"path",
".",
"isdir",... | Get a value after converting to absolute path.
Becoming different from other parameter,
validation of `include` parameter is complex.
Before other validation(at first) this method is called to merge to
one configuration.
:param str path: You can specify relative path and absolut... | [
"Get",
"a",
"value",
"after",
"converting",
"to",
"absolute",
"path",
".",
"Becoming",
"different",
"from",
"other",
"parameter",
"validation",
"of",
"include",
"parameter",
"is",
"complex",
".",
"Before",
"other",
"validation",
"(",
"at",
"first",
")",
"this"... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L93-L111 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._validate_global_include | def _validate_global_include(self, path):
"""
Normally validation method is writen in each validation of parameters.
But `include` of global section needs to be read before validation.
:param str path: absolute path
:rtype: bool
:return: If given path passes validation, ... | python | def _validate_global_include(self, path):
"""
Normally validation method is writen in each validation of parameters.
But `include` of global section needs to be read before validation.
:param str path: absolute path
:rtype: bool
:return: If given path passes validation, ... | [
"def",
"_validate_global_include",
"(",
"self",
",",
"path",
")",
":",
"if",
"not",
"path",
".",
"endswith",
"(",
"'/'",
")",
":",
"path",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"path",
")",
"if",
"os",
".",
"path",
".",
"exists",
"(",
"path"... | Normally validation method is writen in each validation of parameters.
But `include` of global section needs to be read before validation.
:param str path: absolute path
:rtype: bool
:return: If given path passes validation, returns True. | [
"Normally",
"validation",
"method",
"is",
"writen",
"in",
"each",
"validation",
"of",
"parameters",
".",
"But",
"include",
"of",
"global",
"section",
"needs",
"to",
"be",
"read",
"before",
"validation",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L113-L142 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._merge_includes | def _merge_includes(self):
"""
If "include" option exists in "default.cfg",
read the file(glob-match) in the directory.
"""
raw_include_path = self.get_global_include()
if raw_include_path:
abs_include_path = self._get_global_include_abs_path(
... | python | def _merge_includes(self):
"""
If "include" option exists in "default.cfg",
read the file(glob-match) in the directory.
"""
raw_include_path = self.get_global_include()
if raw_include_path:
abs_include_path = self._get_global_include_abs_path(
... | [
"def",
"_merge_includes",
"(",
"self",
")",
":",
"raw_include_path",
"=",
"self",
".",
"get_global_include",
"(",
")",
"if",
"raw_include_path",
":",
"abs_include_path",
"=",
"self",
".",
"_get_global_include_abs_path",
"(",
"raw_include_path",
")",
"self",
".",
"... | If "include" option exists in "default.cfg",
read the file(glob-match) in the directory. | [
"If",
"include",
"option",
"exists",
"in",
"default",
".",
"cfg",
"read",
"the",
"file",
"(",
"glob",
"-",
"match",
")",
"in",
"the",
"directory",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L150-L166 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.register | def register(self, observers):
"""
Concrete method of Subject.register().
Register observers as an argument to self.observers.
"""
if isinstance(observers, list) or isinstance(observers, tuple):
for observer in observers:
# check whether inhelitance ... | python | def register(self, observers):
"""
Concrete method of Subject.register().
Register observers as an argument to self.observers.
"""
if isinstance(observers, list) or isinstance(observers, tuple):
for observer in observers:
# check whether inhelitance ... | [
"def",
"register",
"(",
"self",
",",
"observers",
")",
":",
"if",
"isinstance",
"(",
"observers",
",",
"list",
")",
"or",
"isinstance",
"(",
"observers",
",",
"tuple",
")",
":",
"for",
"observer",
"in",
"observers",
":",
"# check whether inhelitance \"base.Obs... | Concrete method of Subject.register().
Register observers as an argument to self.observers. | [
"Concrete",
"method",
"of",
"Subject",
".",
"register",
"()",
".",
"Register",
"observers",
"as",
"an",
"argument",
"to",
"self",
".",
"observers",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L168-L185 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.unregister | def unregister(self, observers):
u"""
Concrete method of Subject.unregister().
Unregister observers as an argument to self.observers.
"""
if isinstance(observers, list) or isinstance(observers, tuple):
for observer in observers:
try:
... | python | def unregister(self, observers):
u"""
Concrete method of Subject.unregister().
Unregister observers as an argument to self.observers.
"""
if isinstance(observers, list) or isinstance(observers, tuple):
for observer in observers:
try:
... | [
"def",
"unregister",
"(",
"self",
",",
"observers",
")",
":",
"if",
"isinstance",
"(",
"observers",
",",
"list",
")",
"or",
"isinstance",
"(",
"observers",
",",
"tuple",
")",
":",
"for",
"observer",
"in",
"observers",
":",
"try",
":",
"index",
"=",
"se... | u"""
Concrete method of Subject.unregister().
Unregister observers as an argument to self.observers. | [
"u",
"Concrete",
"method",
"of",
"Subject",
".",
"unregister",
"()",
".",
"Unregister",
"observers",
"as",
"an",
"argument",
"to",
"self",
".",
"observers",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L187-L216 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.notify | def notify(self, name, job):
"""
Concrete method of Subject.notify().
Notify to change the status of Subject for observer.
This method call Observer.update().
In this program, ConfigReader.notify() call JobObserver.update().
For exmaple, register threads.redis.ConcreateJo... | python | def notify(self, name, job):
"""
Concrete method of Subject.notify().
Notify to change the status of Subject for observer.
This method call Observer.update().
In this program, ConfigReader.notify() call JobObserver.update().
For exmaple, register threads.redis.ConcreateJo... | [
"def",
"notify",
"(",
"self",
",",
"name",
",",
"job",
")",
":",
"for",
"observer",
"in",
"self",
".",
"_observers",
":",
"observer",
".",
"update",
"(",
"name",
",",
"job",
")"
] | Concrete method of Subject.notify().
Notify to change the status of Subject for observer.
This method call Observer.update().
In this program, ConfigReader.notify() call JobObserver.update().
For exmaple, register threads.redis.ConcreateJob to JobObserver.jobs. | [
"Concrete",
"method",
"of",
"Subject",
".",
"notify",
"()",
".",
"Notify",
"to",
"change",
"the",
"status",
"of",
"Subject",
"for",
"observer",
".",
"This",
"method",
"call",
"Observer",
".",
"update",
"()",
".",
"In",
"this",
"program",
"ConfigReader",
".... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L218-L227 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.add_default_module_dir | def add_default_module_dir(self):
"""
Add directory to store built-in plugins to `module_dir` parameter.
Default directory to store plugins is `BLACKBIRD_INSTALL_DIR/plugins`.
:rtype: None
:return: None
"""
default_module_dir = os.path.join(
os.path.ab... | python | def add_default_module_dir(self):
"""
Add directory to store built-in plugins to `module_dir` parameter.
Default directory to store plugins is `BLACKBIRD_INSTALL_DIR/plugins`.
:rtype: None
:return: None
"""
default_module_dir = os.path.join(
os.path.ab... | [
"def",
"add_default_module_dir",
"(",
"self",
")",
":",
"default_module_dir",
"=",
"os",
".",
"path",
".",
"join",
"(",
"os",
".",
"path",
".",
"abspath",
"(",
"os",
".",
"path",
".",
"curdir",
")",
",",
"'plugins'",
")",
"module_dir_params",
"=",
"{",
... | Add directory to store built-in plugins to `module_dir` parameter.
Default directory to store plugins is `BLACKBIRD_INSTALL_DIR/plugins`.
:rtype: None
:return: None | [
"Add",
"directory",
"to",
"store",
"built",
"-",
"in",
"plugins",
"to",
"module_dir",
"parameter",
".",
"Default",
"directory",
"to",
"store",
"plugins",
"is",
"BLACKBIRD_INSTALL_DIR",
"/",
"plugins",
".",
":",
"rtype",
":",
"None",
":",
"return",
":",
"None... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L229-L250 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.global_validate | def global_validate(self):
"""
Validate only global section.
The options in global section
is used by other private methods of ConfigReader.
So, validate only global section at first.
"raw_spec" is configspec for global section.
"functions" is passed as an argumen... | python | def global_validate(self):
"""
Validate only global section.
The options in global section
is used by other private methods of ConfigReader.
So, validate only global section at first.
"raw_spec" is configspec for global section.
"functions" is passed as an argumen... | [
"def",
"global_validate",
"(",
"self",
")",
":",
"raw_spec",
"=",
"(",
"\"[global]\"",
",",
"\"user = user(default=bbd)\"",
",",
"\"group = group(default=bbd)\"",
",",
"\"log_file = log(default=/var/log/blackbird/blackbird.log)\"",
",",
"\"log_level = log_level(default='info')\"",
... | Validate only global section.
The options in global section
is used by other private methods of ConfigReader.
So, validate only global section at first.
"raw_spec" is configspec for global section.
"functions" is passed as an argument in "validate.Validator".
about "func... | [
"Validate",
"only",
"global",
"section",
".",
"The",
"options",
"in",
"global",
"section",
"is",
"used",
"by",
"other",
"private",
"methods",
"of",
"ConfigReader",
".",
"So",
"validate",
"only",
"global",
"section",
"at",
"first",
".",
"raw_spec",
"is",
"con... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L252-L308 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._get_modules | def _get_modules(self):
"""
Get modules under the self.config['global']['module_dirs'] directories.
Plugin modules has the two classes of "ConcreteJob" and "Validator".
Further, "Validator.module" property is used to
deciding which one to use plugin module.
This method r... | python | def _get_modules(self):
"""
Get modules under the self.config['global']['module_dirs'] directories.
Plugin modules has the two classes of "ConcreteJob" and "Validator".
Further, "Validator.module" property is used to
deciding which one to use plugin module.
This method r... | [
"def",
"_get_modules",
"(",
"self",
")",
":",
"not_import",
"=",
"set",
"(",
")",
"not_import",
".",
"add",
"(",
"'base'",
")",
"modules",
"=",
"{",
"}",
"for",
"path",
"in",
"self",
".",
"config",
"[",
"'global'",
"]",
"[",
"'module_dir'",
"]",
":",... | Get modules under the self.config['global']['module_dirs'] directories.
Plugin modules has the two classes of "ConcreteJob" and "Validator".
Further, "Validator.module" property is used to
deciding which one to use plugin module.
This method returns a dictionary as following:
mo... | [
"Get",
"modules",
"under",
"the",
"self",
".",
"config",
"[",
"global",
"]",
"[",
"module_dirs",
"]",
"directories",
".",
"Plugin",
"modules",
"has",
"the",
"two",
"classes",
"of",
"ConcreteJob",
"and",
"Validator",
".",
"Further",
"Validator",
".",
"module"... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L310-L350 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._register_jobs | def _register_jobs(self):
"""
This method extracts only the "ConcreteJob" class
from modules that were collected by ConfigReader._get_modules().
And, this method called Subject.notify(),
append "ConcreteJob" classes to JobObserver.jobs.
"""
# job_name is hard-cor... | python | def _register_jobs(self):
"""
This method extracts only the "ConcreteJob" class
from modules that were collected by ConfigReader._get_modules().
And, this method called Subject.notify(),
append "ConcreteJob" classes to JobObserver.jobs.
"""
# job_name is hard-cor... | [
"def",
"_register_jobs",
"(",
"self",
")",
":",
"# job_name is hard-corded",
"job_name",
"=",
"'ConcreteJob'",
"modules",
"=",
"self",
".",
"_get_modules",
"(",
")",
"for",
"section",
",",
"options",
"in",
"self",
".",
"config",
".",
"items",
"(",
")",
":",
... | This method extracts only the "ConcreteJob" class
from modules that were collected by ConfigReader._get_modules().
And, this method called Subject.notify(),
append "ConcreteJob" classes to JobObserver.jobs. | [
"This",
"method",
"extracts",
"only",
"the",
"ConcreteJob",
"class",
"from",
"modules",
"that",
"were",
"collected",
"by",
"ConfigReader",
".",
"_get_modules",
"()",
".",
"And",
"this",
"method",
"called",
"Subject",
".",
"notify",
"()",
"append",
"ConcreteJob",... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L352-L378 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._get_raw_specs | def _get_raw_specs(self, config):
"""
This method extract only the "Validate.spec" from
modules that were collected by ConfigReader._get_modules().
And, this method append "Validate.spec" to raw_specs.
This method creates a dictionary like the following:
raw_specs = {
... | python | def _get_raw_specs(self, config):
"""
This method extract only the "Validate.spec" from
modules that were collected by ConfigReader._get_modules().
And, this method append "Validate.spec" to raw_specs.
This method creates a dictionary like the following:
raw_specs = {
... | [
"def",
"_get_raw_specs",
"(",
"self",
",",
"config",
")",
":",
"# spec_name is hard-corded",
"raw_specs",
"=",
"{",
"}",
"spec_name",
"=",
"'Validator'",
"modules",
"=",
"self",
".",
"_get_modules",
"(",
")",
"for",
"section",
",",
"options",
"in",
"config",
... | This method extract only the "Validate.spec" from
modules that were collected by ConfigReader._get_modules().
And, this method append "Validate.spec" to raw_specs.
This method creates a dictionary like the following:
raw_specs = {
'redis': (
"[redis]",
... | [
"This",
"method",
"extract",
"only",
"the",
"Validate",
".",
"spec",
"from",
"modules",
"that",
"were",
"collected",
"by",
"ConfigReader",
".",
"_get_modules",
"()",
".",
"And",
"this",
"method",
"append",
"Validate",
".",
"spec",
"to",
"raw_specs",
".",
"Th... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L380-L422 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._create_specs | def _create_specs(self):
"""
Create configspec instances based "conf/defaults.cfg".
This function takes as arguments to the required section and module.
Take them out from self.config, _create_specs pass the _config_factory.
"""
raw_specs = self._get_raw_specs(self.confi... | python | def _create_specs(self):
"""
Create configspec instances based "conf/defaults.cfg".
This function takes as arguments to the required section and module.
Take them out from self.config, _create_specs pass the _config_factory.
"""
raw_specs = self._get_raw_specs(self.confi... | [
"def",
"_create_specs",
"(",
"self",
")",
":",
"raw_specs",
"=",
"self",
".",
"_get_raw_specs",
"(",
"self",
".",
"config",
")",
"spec",
"=",
"self",
".",
"_configobj_factory",
"(",
"infile",
"=",
"None",
",",
"_inspec",
"=",
"True",
")",
"for",
"section... | Create configspec instances based "conf/defaults.cfg".
This function takes as arguments to the required section and module.
Take them out from self.config, _create_specs pass the _config_factory. | [
"Create",
"configspec",
"instances",
"based",
"conf",
"/",
"defaults",
".",
"cfg",
".",
"This",
"function",
"takes",
"as",
"arguments",
"to",
"the",
"required",
"section",
"and",
"module",
".",
"Take",
"them",
"out",
"from",
"self",
".",
"config",
"_create_s... | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L424-L452 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._configspec_factory | def _configspec_factory(self, section, module, infile):
"""
ConfigObj(_inspec=True) factory method.
ConfibObj instance that the "_inspec" argument is True
is called "configspec".
This method is called by ConfigReader._create_specs().
Beforehand, you need to define
... | python | def _configspec_factory(self, section, module, infile):
"""
ConfigObj(_inspec=True) factory method.
ConfibObj instance that the "_inspec" argument is True
is called "configspec".
This method is called by ConfigReader._create_specs().
Beforehand, you need to define
... | [
"def",
"_configspec_factory",
"(",
"self",
",",
"section",
",",
"module",
",",
"infile",
")",
":",
"configspec",
"=",
"self",
".",
"_configobj_factory",
"(",
"infile",
"=",
"infile",
",",
"_inspec",
"=",
"True",
")",
"# Override the name of section in spec file",
... | ConfigObj(_inspec=True) factory method.
ConfibObj instance that the "_inspec" argument is True
is called "configspec".
This method is called by ConfigReader._create_specs().
Beforehand, you need to define
type definitions and default values in "spec file" as follow:
[mem... | [
"ConfigObj",
"(",
"_inspec",
"=",
"True",
")",
"factory",
"method",
".",
"ConfibObj",
"instance",
"that",
"the",
"_inspec",
"argument",
"is",
"True",
"is",
"called",
"configspec",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L454-L497 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader.validate | def validate(self):
"""
validate whether value in config file is correct.
"""
spec = self._create_specs()
# support in future
functions = {}
validator = validate.Validator(functions=functions)
self.config.configspec = spec
result = self.config.... | python | def validate(self):
"""
validate whether value in config file is correct.
"""
spec = self._create_specs()
# support in future
functions = {}
validator = validate.Validator(functions=functions)
self.config.configspec = spec
result = self.config.... | [
"def",
"validate",
"(",
"self",
")",
":",
"spec",
"=",
"self",
".",
"_create_specs",
"(",
")",
"# support in future",
"functions",
"=",
"{",
"}",
"validator",
"=",
"validate",
".",
"Validator",
"(",
"functions",
"=",
"functions",
")",
"self",
".",
"config"... | validate whether value in config file is correct. | [
"validate",
"whether",
"value",
"in",
"config",
"file",
"is",
"correct",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L499-L515 |
Vagrants/blackbird | blackbird/utils/configread.py | ConfigReader._parse_result | def _parse_result(self, result):
u"""
This method parses validation results.
If result is True, then do nothing.
if include even one false to result,
this method parse result and raise Exception.
"""
if result is not True:
for section, errors in result... | python | def _parse_result(self, result):
u"""
This method parses validation results.
If result is True, then do nothing.
if include even one false to result,
this method parse result and raise Exception.
"""
if result is not True:
for section, errors in result... | [
"def",
"_parse_result",
"(",
"self",
",",
"result",
")",
":",
"if",
"result",
"is",
"not",
"True",
":",
"for",
"section",
",",
"errors",
"in",
"result",
".",
"iteritems",
"(",
")",
":",
"for",
"key",
",",
"value",
"in",
"errors",
".",
"iteritems",
"(... | u"""
This method parses validation results.
If result is True, then do nothing.
if include even one false to result,
this method parse result and raise Exception. | [
"u",
"This",
"method",
"parses",
"validation",
"results",
".",
"If",
"result",
"is",
"True",
"then",
"do",
"nothing",
".",
"if",
"include",
"even",
"one",
"false",
"to",
"result",
"this",
"method",
"parse",
"result",
"and",
"raise",
"Exception",
"."
] | train | https://github.com/Vagrants/blackbird/blob/3b38cd5650caae362e0668dbd38bf8f88233e079/blackbird/utils/configread.py#L517-L540 |
jason-weirather/py-seq-tools | seqtools/cli/utilities/pacbio_best_molecule_alignments.py | main | def main(args):
of = sys.stdout
if args.output and args.output[-4:] == '.bam':
cmd = 'samtools view -Sb - -o '+args.output
pof = Popen(cmd.split(),stdin=PIPE)
of = pof.stdin
elif args.output:
of = open(args.output,'w')
"""Use the valid input file to get the header information."""
header = Non... | python | def main(args):
of = sys.stdout
if args.output and args.output[-4:] == '.bam':
cmd = 'samtools view -Sb - -o '+args.output
pof = Popen(cmd.split(),stdin=PIPE)
of = pof.stdin
elif args.output:
of = open(args.output,'w')
"""Use the valid input file to get the header information."""
header = Non... | [
"def",
"main",
"(",
"args",
")",
":",
"of",
"=",
"sys",
".",
"stdout",
"if",
"args",
".",
"output",
"and",
"args",
".",
"output",
"[",
"-",
"4",
":",
"]",
"==",
"'.bam'",
":",
"cmd",
"=",
"'samtools view -Sb - -o '",
"+",
"args",
".",
"output",
"po... | Use the valid input file to get the header information. | [
"Use",
"the",
"valid",
"input",
"file",
"to",
"get",
"the",
"header",
"information",
"."
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/cli/utilities/pacbio_best_molecule_alignments.py#L35-L89 |
jason-weirather/py-seq-tools | seqtools/cli/utilities/pacbio_best_molecule_alignments.py | _do_subread_set | def _do_subread_set(flag,input_file,of,negative_filter,aligned):
best = {}
cmd = 'samtools view '+flag+' '+input_file
sys.stderr.write(cmd+"\n")
p = Popen(cmd.split(),stdout=PIPE)
z = 0
for line in p.stdout:
z += 1
if z%10000==0: sys.stderr.write(str(z) + " subread alignment paths sc... | python | def _do_subread_set(flag,input_file,of,negative_filter,aligned):
best = {}
cmd = 'samtools view '+flag+' '+input_file
sys.stderr.write(cmd+"\n")
p = Popen(cmd.split(),stdout=PIPE)
z = 0
for line in p.stdout:
z += 1
if z%10000==0: sys.stderr.write(str(z) + " subread alignment paths sc... | [
"def",
"_do_subread_set",
"(",
"flag",
",",
"input_file",
",",
"of",
",",
"negative_filter",
",",
"aligned",
")",
":",
"best",
"=",
"{",
"}",
"cmd",
"=",
"'samtools view '",
"+",
"flag",
"+",
"' '",
"+",
"input_file",
"sys",
".",
"stderr",
".",
"write",
... | After getting all the best alignment counts we can traverse again
to keep the best | [
"After",
"getting",
"all",
"the",
"best",
"alignment",
"counts",
"we",
"can",
"traverse",
"again",
"to",
"keep",
"the",
"best"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/cli/utilities/pacbio_best_molecule_alignments.py#L136-L180 |
jason-weirather/py-seq-tools | seqtools/cli/utilities/pacbio_best_molecule_alignments.py | _traverse_unobserved | def _traverse_unobserved(stream,negative_filter,of):
"""Go through a stream and print out anything not in observed set"""
observed = set()
for line in stream:
name = PacBioReadName(_nameprog.match(line).group(1))
if name.get_molecule() not in negative_filter: of.write(line)
observed.add(name.get_molec... | python | def _traverse_unobserved(stream,negative_filter,of):
"""Go through a stream and print out anything not in observed set"""
observed = set()
for line in stream:
name = PacBioReadName(_nameprog.match(line).group(1))
if name.get_molecule() not in negative_filter: of.write(line)
observed.add(name.get_molec... | [
"def",
"_traverse_unobserved",
"(",
"stream",
",",
"negative_filter",
",",
"of",
")",
":",
"observed",
"=",
"set",
"(",
")",
"for",
"line",
"in",
"stream",
":",
"name",
"=",
"PacBioReadName",
"(",
"_nameprog",
".",
"match",
"(",
"line",
")",
".",
"group"... | Go through a stream and print out anything not in observed set | [
"Go",
"through",
"a",
"stream",
"and",
"print",
"out",
"anything",
"not",
"in",
"observed",
"set"
] | train | https://github.com/jason-weirather/py-seq-tools/blob/f642c2c73ffef2acc83656a78059a476fc734ca1/seqtools/cli/utilities/pacbio_best_molecule_alignments.py#L182-L189 |
delfick/harpoon | harpoon/task_finder.py | TaskFinder.default_tasks | def default_tasks(self):
"""Return default tasks"""
return dict((name, Task(action=name, label="Harpoon")) for name in default_actions) | python | def default_tasks(self):
"""Return default tasks"""
return dict((name, Task(action=name, label="Harpoon")) for name in default_actions) | [
"def",
"default_tasks",
"(",
"self",
")",
":",
"return",
"dict",
"(",
"(",
"name",
",",
"Task",
"(",
"action",
"=",
"name",
",",
"label",
"=",
"\"Harpoon\"",
")",
")",
"for",
"name",
"in",
"default_actions",
")"
] | Return default tasks | [
"Return",
"default",
"tasks"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/task_finder.py#L22-L24 |
delfick/harpoon | harpoon/task_finder.py | TaskFinder.find_tasks | def find_tasks(self, overrides):
"""Find the custom tasks and record the associated image with each task"""
tasks = self.default_tasks()
configuration = self.collector.configuration
for image in list(configuration["images"].keys()):
path = configuration.path(["images", image... | python | def find_tasks(self, overrides):
"""Find the custom tasks and record the associated image with each task"""
tasks = self.default_tasks()
configuration = self.collector.configuration
for image in list(configuration["images"].keys()):
path = configuration.path(["images", image... | [
"def",
"find_tasks",
"(",
"self",
",",
"overrides",
")",
":",
"tasks",
"=",
"self",
".",
"default_tasks",
"(",
")",
"configuration",
"=",
"self",
".",
"collector",
".",
"configuration",
"for",
"image",
"in",
"list",
"(",
"configuration",
"[",
"\"images\"",
... | Find the custom tasks and record the associated image with each task | [
"Find",
"the",
"custom",
"tasks",
"and",
"record",
"the",
"associated",
"image",
"with",
"each",
"task"
] | train | https://github.com/delfick/harpoon/blob/a2d39311d6127b7da2e15f40468bf320d598e461/harpoon/task_finder.py#L26-L40 |
nrcharles/caelum | caelum/nsrdb.py | strptime | def strptime(string, timezone=0):
"""necessary because of 24:00 end of day labeling"""
year = int(string[0:4])
month = int(string[5:7])
day = int(string[8:10])
hour = int(string[-5:-3])
minute = int(string[-2:])
ts = datetime.datetime(year, month, day) + \
datetime.timedelta(hours=ho... | python | def strptime(string, timezone=0):
"""necessary because of 24:00 end of day labeling"""
year = int(string[0:4])
month = int(string[5:7])
day = int(string[8:10])
hour = int(string[-5:-3])
minute = int(string[-2:])
ts = datetime.datetime(year, month, day) + \
datetime.timedelta(hours=ho... | [
"def",
"strptime",
"(",
"string",
",",
"timezone",
"=",
"0",
")",
":",
"year",
"=",
"int",
"(",
"string",
"[",
"0",
":",
"4",
"]",
")",
"month",
"=",
"int",
"(",
"string",
"[",
"5",
":",
"7",
"]",
")",
"day",
"=",
"int",
"(",
"string",
"[",
... | necessary because of 24:00 end of day labeling | [
"necessary",
"because",
"of",
"24",
":",
"00",
"end",
"of",
"day",
"labeling"
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/nsrdb.py#L16-L26 |
nrcharles/caelum | caelum/nsrdb.py | monthly | def monthly(usaf, year, field='GHI (W/m^2)'):
"""monthly insolation"""
m = []
lastm = 1
usafdata = Data(usaf, year)
t = 0
for r in usafdata:
r['GHI (W/m^2)'] = r['Glo Mod (Wh/m^2)']
r['DHI (W/m^2)'] = r['Dif Mod (Wh/m^2)']
r['DNI (W/m^2)'] = r['Dir Mod (Wh/m^2)']
... | python | def monthly(usaf, year, field='GHI (W/m^2)'):
"""monthly insolation"""
m = []
lastm = 1
usafdata = Data(usaf, year)
t = 0
for r in usafdata:
r['GHI (W/m^2)'] = r['Glo Mod (Wh/m^2)']
r['DHI (W/m^2)'] = r['Dif Mod (Wh/m^2)']
r['DNI (W/m^2)'] = r['Dir Mod (Wh/m^2)']
... | [
"def",
"monthly",
"(",
"usaf",
",",
"year",
",",
"field",
"=",
"'GHI (W/m^2)'",
")",
":",
"m",
"=",
"[",
"]",
"lastm",
"=",
"1",
"usafdata",
"=",
"Data",
"(",
"usaf",
",",
"year",
")",
"t",
"=",
"0",
"for",
"r",
"in",
"usafdata",
":",
"r",
"[",... | monthly insolation | [
"monthly",
"insolation"
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/nsrdb.py#L74-L89 |
nrcharles/caelum | caelum/nsrdb.py | report | def report(usaf):
"""generate report for usaf base"""
fig = plt.figure()
ax = fig.add_subplot(111)
station_info = geo.station_info(usaf)
y = {}
for i in range(1991, 2011):
monthData = monthly(usaf, i)
t = sum(monthData)
y[i] = t
print t
tmy3tot = tmy3.total(us... | python | def report(usaf):
"""generate report for usaf base"""
fig = plt.figure()
ax = fig.add_subplot(111)
station_info = geo.station_info(usaf)
y = {}
for i in range(1991, 2011):
monthData = monthly(usaf, i)
t = sum(monthData)
y[i] = t
print t
tmy3tot = tmy3.total(us... | [
"def",
"report",
"(",
"usaf",
")",
":",
"fig",
"=",
"plt",
".",
"figure",
"(",
")",
"ax",
"=",
"fig",
".",
"add_subplot",
"(",
"111",
")",
"station_info",
"=",
"geo",
".",
"station_info",
"(",
"usaf",
")",
"y",
"=",
"{",
"}",
"for",
"i",
"in",
... | generate report for usaf base | [
"generate",
"report",
"for",
"usaf",
"base"
] | train | https://github.com/nrcharles/caelum/blob/9a8e65806385978556d7bb2e6870f003ff82023e/caelum/nsrdb.py#L92-L141 |
mitsei/dlkit | dlkit/handcar/proxy/sessions.py | ProxySession.get_proxy | def get_proxy(self, input):
"""Gets a proxy.
:param input: a proxy condition
:type input: ``osid.proxy.ProxyCondition``
:return: a proxy
:rtype: ``osid.proxy.Proxy``
:raise: ``NullArgument`` -- ``input`` is ``null``
:raise: ``OperationFailed`` -- unable to comple... | python | def get_proxy(self, input):
"""Gets a proxy.
:param input: a proxy condition
:type input: ``osid.proxy.ProxyCondition``
:return: a proxy
:rtype: ``osid.proxy.Proxy``
:raise: ``NullArgument`` -- ``input`` is ``null``
:raise: ``OperationFailed`` -- unable to comple... | [
"def",
"get_proxy",
"(",
"self",
",",
"input",
")",
":",
"from",
".",
".",
"authentication_process",
".",
"objects",
"import",
"Authentication",
"agent_id",
"=",
"input",
".",
"user",
".",
"username",
"host",
"=",
"settings",
".",
"HOST",
"url_path",
"=",
... | Gets a proxy.
:param input: a proxy condition
:type input: ``osid.proxy.ProxyCondition``
:return: a proxy
:rtype: ``osid.proxy.Proxy``
:raise: ``NullArgument`` -- ``input`` is ``null``
:raise: ``OperationFailed`` -- unable to complete request
:raise: ``Permission... | [
"Gets",
"a",
"proxy",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/handcar/proxy/sessions.py#L37-L59 |
MacHu-GWU/docfly-project | docfly/util.py | make_file | def make_file(abspath, text):
"""
Make a file with utf-8 text.
"""
try:
with open(abspath, "wb") as f:
f.write(text.encode("utf-8"))
print("Made: %s" % abspath)
except: # pragma: no cover
pass | python | def make_file(abspath, text):
"""
Make a file with utf-8 text.
"""
try:
with open(abspath, "wb") as f:
f.write(text.encode("utf-8"))
print("Made: %s" % abspath)
except: # pragma: no cover
pass | [
"def",
"make_file",
"(",
"abspath",
",",
"text",
")",
":",
"try",
":",
"with",
"open",
"(",
"abspath",
",",
"\"wb\"",
")",
"as",
"f",
":",
"f",
".",
"write",
"(",
"text",
".",
"encode",
"(",
"\"utf-8\"",
")",
")",
"print",
"(",
"\"Made: %s\"",
"%",... | Make a file with utf-8 text. | [
"Make",
"a",
"file",
"with",
"utf",
"-",
"8",
"text",
"."
] | train | https://github.com/MacHu-GWU/docfly-project/blob/46da8a9793211301c3ebc12d195228dbf79fdfec/docfly/util.py#L23-L32 |
ascribe/pyspool | spool/file.py | File._calculate_hash | def _calculate_hash(self, filename, **kwargs):
"""
Calculates the hash of the file and the hash of the file + metadata
(passed in ``kwargs``).
Args:
filename (str): Name of the file
testnet (bool): testnet flag. Defaults to False
**kwargs: Additional ... | python | def _calculate_hash(self, filename, **kwargs):
"""
Calculates the hash of the file and the hash of the file + metadata
(passed in ``kwargs``).
Args:
filename (str): Name of the file
testnet (bool): testnet flag. Defaults to False
**kwargs: Additional ... | [
"def",
"_calculate_hash",
"(",
"self",
",",
"filename",
",",
"*",
"*",
"kwargs",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'rb'",
")",
"as",
"f",
":",
"file_hash",
"=",
"hashlib",
".",
"md5",
"(",
"f",
".",
"read",
"(",
")",
")",
".",
"hex... | Calculates the hash of the file and the hash of the file + metadata
(passed in ``kwargs``).
Args:
filename (str): Name of the file
testnet (bool): testnet flag. Defaults to False
**kwargs: Additional metadata to be encoded with the file. Only
the valu... | [
"Calculates",
"the",
"hash",
"of",
"the",
"file",
"and",
"the",
"hash",
"of",
"the",
"file",
"+",
"metadata",
"(",
"passed",
"in",
"kwargs",
")",
"."
] | train | https://github.com/ascribe/pyspool/blob/f8b10df1e7d2ea7950dde433c1cb6d5225112f4f/spool/file.py#L67-L101 |
mitsei/dlkit | dlkit/json_/repository/queries.py | AssetQuery.match_created_date | def match_created_date(self, start, end, match):
"""Match assets that are created between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boolean):... | python | def match_created_date(self, start, end, match):
"""Match assets that are created between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boolean):... | [
"def",
"match_created_date",
"(",
"self",
",",
"start",
",",
"end",
",",
"match",
")",
":",
"self",
".",
"_match_minimum_date_time",
"(",
"'createdDate'",
",",
"start",
",",
"match",
")",
"self",
".",
"_match_maximum_date_time",
"(",
"'createdDate'",
",",
"end... | Match assets that are created between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boolean): ``true`` for a positive match,
``false`` fo... | [
"Match",
"assets",
"that",
"are",
"created",
"between",
"the",
"specified",
"time",
"period",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/queries.py#L341-L355 |
mitsei/dlkit | dlkit/json_/repository/queries.py | AssetQuery.match_published_date | def match_published_date(self, start, end, match):
"""Match assets that are published between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boole... | python | def match_published_date(self, start, end, match):
"""Match assets that are published between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boole... | [
"def",
"match_published_date",
"(",
"self",
",",
"start",
",",
"end",
",",
"match",
")",
":",
"self",
".",
"_match_minimum_date_time",
"(",
"'publishedDate'",
",",
"start",
",",
"match",
")",
"self",
".",
"_match_maximum_date_time",
"(",
"'publishedDate'",
",",
... | Match assets that are published between the specified time period.
arg: start (osid.calendaring.DateTime): start time of the
query
arg: end (osid.calendaring.DateTime): end time of the query
arg: match (boolean): ``true`` for a positive match,
``false`` ... | [
"Match",
"assets",
"that",
"are",
"published",
"between",
"the",
"specified",
"time",
"period",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/repository/queries.py#L402-L416 |
chop-dbhi/varify | varify/accounts/views.py | throttled_login | def throttled_login(request):
"Displays the login form and handles the login action."
# if the user is already logged-in, simply redirect them to the entry page
if request.user.is_authenticated():
return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL)
login_allowed = request.session.get('logi... | python | def throttled_login(request):
"Displays the login form and handles the login action."
# if the user is already logged-in, simply redirect them to the entry page
if request.user.is_authenticated():
return HttpResponseRedirect(settings.LOGIN_REDIRECT_URL)
login_allowed = request.session.get('logi... | [
"def",
"throttled_login",
"(",
"request",
")",
":",
"# if the user is already logged-in, simply redirect them to the entry page",
"if",
"request",
".",
"user",
".",
"is_authenticated",
"(",
")",
":",
"return",
"HttpResponseRedirect",
"(",
"settings",
".",
"LOGIN_REDIRECT_UR... | Displays the login form and handles the login action. | [
"Displays",
"the",
"login",
"form",
"and",
"handles",
"the",
"login",
"action",
"."
] | train | https://github.com/chop-dbhi/varify/blob/5dc721e49ed9bd3582f4b117785fdd1a8b6ba777/varify/accounts/views.py#L13-L39 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comment | def get_comment(self, comment_id):
"""Gets the ``Comment`` specified by its ``Id``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to retrieve
return: (osid.commenting.Comment) - the returned ``Comment``
raise: NotFound - no ``Comment`` found with the gi... | python | def get_comment(self, comment_id):
"""Gets the ``Comment`` specified by its ``Id``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to retrieve
return: (osid.commenting.Comment) - the returned ``Comment``
raise: NotFound - no ``Comment`` found with the gi... | [
"def",
"get_comment",
"(",
"self",
",",
"comment_id",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resource",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'commenting'",
",",
... | Gets the ``Comment`` specified by its ``Id``.
arg: comment_id (osid.id.Id): the ``Id`` of the ``Comment``
to retrieve
return: (osid.commenting.Comment) - the returned ``Comment``
raise: NotFound - no ``Comment`` found with the given ``Id``
raise: NullArgument - ``co... | [
"Gets",
"the",
"Comment",
"specified",
"by",
"its",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L184-L206 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_by_ids | def get_comments_by_ids(self, comment_ids):
"""Gets a ``CommentList`` corresponding to the given ``IdList``.
arg: comment_ids (osid.id.IdList): the list of ``Ids`` to
retrieve
return: (osid.commenting.CommentList) - the returned ``Comment
list``
raise:... | python | def get_comments_by_ids(self, comment_ids):
"""Gets a ``CommentList`` corresponding to the given ``IdList``.
arg: comment_ids (osid.id.IdList): the list of ``Ids`` to
retrieve
return: (osid.commenting.CommentList) - the returned ``Comment
list``
raise:... | [
"def",
"get_comments_by_ids",
"(",
"self",
",",
"comment_ids",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_ids",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidated",
"(",
"'comme... | Gets a ``CommentList`` corresponding to the given ``IdList``.
arg: comment_ids (osid.id.IdList): the list of ``Ids`` to
retrieve
return: (osid.commenting.CommentList) - the returned ``Comment
list``
raise: NotFound - an ``Id was`` not found
raise: Nu... | [
"Gets",
"a",
"CommentList",
"corresponding",
"to",
"the",
"given",
"IdList",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L209-L242 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_by_genus_type | def get_comments_by_genus_type(self, comment_genus_type):
"""Gets a ``CommentList`` corresponding to the given comment genus ``Type`` which does not include comments of genus types derived from the specified ``Type``.
arg: comment_genus_type (osid.type.Type): a comment genus
type
... | python | def get_comments_by_genus_type(self, comment_genus_type):
"""Gets a ``CommentList`` corresponding to the given comment genus ``Type`` which does not include comments of genus types derived from the specified ``Type``.
arg: comment_genus_type (osid.type.Type): a comment genus
type
... | [
"def",
"get_comments_by_genus_type",
"(",
"self",
",",
"comment_genus_type",
")",
":",
"# Implemented from template for",
"# osid.resource.ResourceLookupSession.get_resources_by_genus_type",
"# NOTE: This implementation currently ignores plenary view",
"collection",
"=",
"JSONClientValidat... | Gets a ``CommentList`` corresponding to the given comment genus ``Type`` which does not include comments of genus types derived from the specified ``Type``.
arg: comment_genus_type (osid.type.Type): a comment genus
type
return: (osid.commenting.CommentList) - the returned ``Comment``... | [
"Gets",
"a",
"CommentList",
"corresponding",
"to",
"the",
"given",
"comment",
"genus",
"Type",
"which",
"does",
"not",
"include",
"comments",
"of",
"genus",
"types",
"derived",
"from",
"the",
"specified",
"Type",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L245-L267 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_on_date | def get_comments_on_date(self, from_, to):
"""Gets a ``CommentList`` effective during the entire given date range inclusive but not confined to the date range.
arg: from (osid.calendaring.DateTime): starting date
arg: to (osid.calendaring.DateTime): ending date
return: (osid.comme... | python | def get_comments_on_date(self, from_, to):
"""Gets a ``CommentList`` effective during the entire given date range inclusive but not confined to the date range.
arg: from (osid.calendaring.DateTime): starting date
arg: to (osid.calendaring.DateTime): ending date
return: (osid.comme... | [
"def",
"get_comments_on_date",
"(",
"self",
",",
"from_",
",",
"to",
")",
":",
"# Implemented from template for",
"# osid.relationship.RelationshipLookupSession.get_relationships_on_date",
"comment_list",
"=",
"[",
"]",
"for",
"comment",
"in",
"self",
".",
"get_comments",
... | Gets a ``CommentList`` effective during the entire given date range inclusive but not confined to the date range.
arg: from (osid.calendaring.DateTime): starting date
arg: to (osid.calendaring.DateTime): ending date
return: (osid.commenting.CommentList) - the returned ``Comment``
... | [
"Gets",
"a",
"CommentList",
"effective",
"during",
"the",
"entire",
"given",
"date",
"range",
"inclusive",
"but",
"not",
"confined",
"to",
"the",
"date",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L308-L328 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_for_commentor_on_date | def get_comments_for_commentor_on_date(self, resource_id, from_, to):
"""Gets a list of all comments corresponding to a resource ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg... | python | def get_comments_for_commentor_on_date(self, resource_id, from_, to):
"""Gets a list of all comments corresponding to a resource ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg... | [
"def",
"get_comments_for_commentor_on_date",
"(",
"self",
",",
"resource_id",
",",
"from_",
",",
"to",
")",
":",
"# Implemented from template for",
"# osid.relationship.RelationshipLookupSession.get_relationships_for_destination_on_date",
"comment_list",
"=",
"[",
"]",
"for",
"... | Gets a list of all comments corresponding to a resource ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg: from (osid.calendaring.DateTime): from date
arg: to (osid.calenda... | [
"Gets",
"a",
"list",
"of",
"all",
"comments",
"corresponding",
"to",
"a",
"resource",
"Id",
"and",
"effective",
"during",
"the",
"entire",
"given",
"date",
"range",
"inclusive",
"but",
"not",
"confined",
"to",
"the",
"date",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L375-L397 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_for_reference_on_date | def get_comments_for_reference_on_date(self, reference_id, from_, to):
"""Gets a list of all comments corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: reference_id (osid.id.Id): a reference ``Id``
arg: ... | python | def get_comments_for_reference_on_date(self, reference_id, from_, to):
"""Gets a list of all comments corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: reference_id (osid.id.Id): a reference ``Id``
arg: ... | [
"def",
"get_comments_for_reference_on_date",
"(",
"self",
",",
"reference_id",
",",
"from_",
",",
"to",
")",
":",
"# Implemented from template for",
"# osid.relationship.RelationshipLookupSession.get_relationships_for_source_on_date",
"comment_list",
"=",
"[",
"]",
"for",
"comm... | Gets a list of all comments corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: reference_id (osid.id.Id): a reference ``Id``
arg: from (osid.calendaring.DateTime): from date
arg: to (osid.calendaring.D... | [
"Gets",
"a",
"list",
"of",
"all",
"comments",
"corresponding",
"to",
"a",
"reference",
"Id",
"and",
"effective",
"during",
"the",
"entire",
"given",
"date",
"range",
"inclusive",
"but",
"not",
"confined",
"to",
"the",
"date",
"range",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L473-L495 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_by_genus_type_for_reference_on_date | def get_comments_by_genus_type_for_reference_on_date(self, reference_id, comment_genus_type, from_, to):
"""Gets a list of all comments of the given genus type corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: refe... | python | def get_comments_by_genus_type_for_reference_on_date(self, reference_id, comment_genus_type, from_, to):
"""Gets a list of all comments of the given genus type corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: refe... | [
"def",
"get_comments_by_genus_type_for_reference_on_date",
"(",
"self",
",",
"reference_id",
",",
"comment_genus_type",
",",
"from_",
",",
"to",
")",
":",
"# Implemented from template for",
"# osid.relationship.RelationshipLookupSession.get_relationships_by_genus_type_for_source_on_dat... | Gets a list of all comments of the given genus type corresponding to a reference ``Id`` and effective during the entire given date range inclusive but not confined to the date range.
arg: reference_id (osid.id.Id): a reference ``Id``
arg: comment_genus_type (osid.type.Type): the comment genus
... | [
"Gets",
"a",
"list",
"of",
"all",
"comments",
"of",
"the",
"given",
"genus",
"type",
"corresponding",
"to",
"a",
"reference",
"Id",
"and",
"effective",
"during",
"the",
"entire",
"given",
"date",
"range",
"inclusive",
"but",
"not",
"confined",
"to",
"the",
... | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L526-L550 |
mitsei/dlkit | dlkit/json_/commenting/sessions.py | CommentLookupSession.get_comments_for_commentor_and_reference | def get_comments_for_commentor_and_reference(self, resource_id, reference_id):
"""Gets a list of comments corresponding to a resource and reference ``Id``.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg: reference_id (osid.id.Id): the ``Id`` of the reference
return:... | python | def get_comments_for_commentor_and_reference(self, resource_id, reference_id):
"""Gets a list of comments corresponding to a resource and reference ``Id``.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg: reference_id (osid.id.Id): the ``Id`` of the reference
return:... | [
"def",
"get_comments_for_commentor_and_reference",
"(",
"self",
",",
"resource_id",
",",
"reference_id",
")",
":",
"# Implemented from template for",
"# osid.relationship.RelationshipLookupSession.get_relationships_for_peers",
"# NOTE: This implementation currently ignores plenary and effect... | Gets a list of comments corresponding to a resource and reference ``Id``.
arg: resource_id (osid.id.Id): the ``Id`` of the resource
arg: reference_id (osid.id.Id): the ``Id`` of the reference
return: (osid.commenting.CommentList) - the returned
``CommentList``
rais... | [
"Gets",
"a",
"list",
"of",
"comments",
"corresponding",
"to",
"a",
"resource",
"and",
"reference",
"Id",
"."
] | train | https://github.com/mitsei/dlkit/blob/445f968a175d61c8d92c0f617a3c17dc1dc7c584/dlkit/json_/commenting/sessions.py#L553-L577 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.