id int32 0 252k | repo stringlengths 7 55 | path stringlengths 4 127 | func_name stringlengths 1 88 | original_string stringlengths 75 19.8k | language stringclasses 1
value | code stringlengths 75 19.8k | code_tokens list | docstring stringlengths 3 17.3k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 87 242 |
|---|---|---|---|---|---|---|---|---|---|---|---|
249,200 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess._find_models | def _find_models(self, constructor, table_name, constraints=None, *, columns=None,
order_by=None, limiting=None):
"""Calls DataAccess.find_all and passes the results to the given constructor."""
for record in self.find_all(table_name, constraints, columns=columns, order_by=order_by,
... | python | def _find_models(self, constructor, table_name, constraints=None, *, columns=None,
order_by=None, limiting=None):
"""Calls DataAccess.find_all and passes the results to the given constructor."""
for record in self.find_all(table_name, constraints, columns=columns, order_by=order_by,
... | [
"def",
"_find_models",
"(",
"self",
",",
"constructor",
",",
"table_name",
",",
"constraints",
"=",
"None",
",",
"*",
",",
"columns",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"limiting",
"=",
"None",
")",
":",
"for",
"record",
"in",
"self",
".",... | Calls DataAccess.find_all and passes the results to the given constructor. | [
"Calls",
"DataAccess",
".",
"find_all",
"and",
"passes",
"the",
"results",
"to",
"the",
"given",
"constructor",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L16-L21 |
249,201 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_model | def find_model(self, constructor, constraints=None, *, columns=None, table_name=None,
order_by=None):
"""Specialization of DataAccess.find that returns a model instead of cursor object."""
return self._find_model(constructor, table_name or constructor.table_name, constraints,
... | python | def find_model(self, constructor, constraints=None, *, columns=None, table_name=None,
order_by=None):
"""Specialization of DataAccess.find that returns a model instead of cursor object."""
return self._find_model(constructor, table_name or constructor.table_name, constraints,
... | [
"def",
"find_model",
"(",
"self",
",",
"constructor",
",",
"constraints",
"=",
"None",
",",
"*",
",",
"columns",
"=",
"None",
",",
"table_name",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"return",
"self",
".",
"_find_model",
"(",
"constructor"... | Specialization of DataAccess.find that returns a model instead of cursor object. | [
"Specialization",
"of",
"DataAccess",
".",
"find",
"that",
"returns",
"a",
"model",
"instead",
"of",
"cursor",
"object",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L23-L27 |
249,202 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_models | def find_models(self, constructor, constraints=None, *, columns=None, order_by=None,
limiting=None, table_name=None):
"""Specialization of DataAccess.find_all that returns models instead of cursor objects."""
return self._find_models(
constructor, table_name or constructor.table_name, co... | python | def find_models(self, constructor, constraints=None, *, columns=None, order_by=None,
limiting=None, table_name=None):
"""Specialization of DataAccess.find_all that returns models instead of cursor objects."""
return self._find_models(
constructor, table_name or constructor.table_name, co... | [
"def",
"find_models",
"(",
"self",
",",
"constructor",
",",
"constraints",
"=",
"None",
",",
"*",
",",
"columns",
"=",
"None",
",",
"order_by",
"=",
"None",
",",
"limiting",
"=",
"None",
",",
"table_name",
"=",
"None",
")",
":",
"return",
"self",
".",
... | Specialization of DataAccess.find_all that returns models instead of cursor objects. | [
"Specialization",
"of",
"DataAccess",
".",
"find_all",
"that",
"returns",
"models",
"instead",
"of",
"cursor",
"objects",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L29-L34 |
249,203 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.page_models | def page_models(self, constructor, paging, constraints=None, *, columns=None, order_by=None):
"""Specialization of DataAccess.page that returns models instead of cursor objects."""
records, count = self.page(constructor.table_name, paging, constraints, columns=columns,
order_by=or... | python | def page_models(self, constructor, paging, constraints=None, *, columns=None, order_by=None):
"""Specialization of DataAccess.page that returns models instead of cursor objects."""
records, count = self.page(constructor.table_name, paging, constraints, columns=columns,
order_by=or... | [
"def",
"page_models",
"(",
"self",
",",
"constructor",
",",
"paging",
",",
"constraints",
"=",
"None",
",",
"*",
",",
"columns",
"=",
"None",
",",
"order_by",
"=",
"None",
")",
":",
"records",
",",
"count",
"=",
"self",
".",
"page",
"(",
"constructor",... | Specialization of DataAccess.page that returns models instead of cursor objects. | [
"Specialization",
"of",
"DataAccess",
".",
"page",
"that",
"returns",
"models",
"instead",
"of",
"cursor",
"objects",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L36-L40 |
249,204 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_model_by_id | def find_model_by_id(self, constructor, id_, *, columns=None):
"""Searches for a model by id, according to its class' primary_key_name.
If primary_key_name is a tuple, id_ must be a tuple with a matching length.
"""
return self.find_model(
constructor, get_id_constraints(constructor.primary_key_n... | python | def find_model_by_id(self, constructor, id_, *, columns=None):
"""Searches for a model by id, according to its class' primary_key_name.
If primary_key_name is a tuple, id_ must be a tuple with a matching length.
"""
return self.find_model(
constructor, get_id_constraints(constructor.primary_key_n... | [
"def",
"find_model_by_id",
"(",
"self",
",",
"constructor",
",",
"id_",
",",
"*",
",",
"columns",
"=",
"None",
")",
":",
"return",
"self",
".",
"find_model",
"(",
"constructor",
",",
"get_id_constraints",
"(",
"constructor",
".",
"primary_key_name",
",",
"id... | Searches for a model by id, according to its class' primary_key_name.
If primary_key_name is a tuple, id_ must be a tuple with a matching length. | [
"Searches",
"for",
"a",
"model",
"by",
"id",
"according",
"to",
"its",
"class",
"primary_key_name",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L42-L48 |
249,205 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.refresh_model | def refresh_model(self, model, *, overwrite=False):
"""Pulls the model's record from the database. If overwrite is True, the model values are
overwritten and returns the model, otherwise a new model instance with the newer record is
returned.
"""
new_model = self.find_model_by_id(model.__class__, mo... | python | def refresh_model(self, model, *, overwrite=False):
"""Pulls the model's record from the database. If overwrite is True, the model values are
overwritten and returns the model, otherwise a new model instance with the newer record is
returned.
"""
new_model = self.find_model_by_id(model.__class__, mo... | [
"def",
"refresh_model",
"(",
"self",
",",
"model",
",",
"*",
",",
"overwrite",
"=",
"False",
")",
":",
"new_model",
"=",
"self",
".",
"find_model_by_id",
"(",
"model",
".",
"__class__",
",",
"model",
".",
"primary_key",
")",
"if",
"overwrite",
":",
"mode... | Pulls the model's record from the database. If overwrite is True, the model values are
overwritten and returns the model, otherwise a new model instance with the newer record is
returned. | [
"Pulls",
"the",
"model",
"s",
"record",
"from",
"the",
"database",
".",
"If",
"overwrite",
"is",
"True",
"the",
"model",
"values",
"are",
"overwritten",
"and",
"returns",
"the",
"model",
"otherwise",
"a",
"new",
"model",
"instance",
"with",
"the",
"newer",
... | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L50-L60 |
249,206 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.update_model | def update_model(self, model, *, include_keys=None):
"""Updates a model.
:include_keys: if given, only updates the given attributes. Otherwise, updates all non-id
attributes.
"""
id_constraints = get_model_id_constraints(model)
if include_keys is None:
include_keys = set(
model.a... | python | def update_model(self, model, *, include_keys=None):
"""Updates a model.
:include_keys: if given, only updates the given attributes. Otherwise, updates all non-id
attributes.
"""
id_constraints = get_model_id_constraints(model)
if include_keys is None:
include_keys = set(
model.a... | [
"def",
"update_model",
"(",
"self",
",",
"model",
",",
"*",
",",
"include_keys",
"=",
"None",
")",
":",
"id_constraints",
"=",
"get_model_id_constraints",
"(",
"model",
")",
"if",
"include_keys",
"is",
"None",
":",
"include_keys",
"=",
"set",
"(",
"model",
... | Updates a model.
:include_keys: if given, only updates the given attributes. Otherwise, updates all non-id
attributes. | [
"Updates",
"a",
"model",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L62-L95 |
249,207 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.insert_model | def insert_model(self, model, *, upsert=None):
"""Inserts a record for the given model.
If model's primary key is auto, the primary key will be set appropriately.
"""
pkname = model.primary_key_name
include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql)
if model.primary_key_... | python | def insert_model(self, model, *, upsert=None):
"""Inserts a record for the given model.
If model's primary key is auto, the primary key will be set appropriately.
"""
pkname = model.primary_key_name
include_keys = set(model.attrs.keys()).difference(model.exclude_keys_sql)
if model.primary_key_... | [
"def",
"insert_model",
"(",
"self",
",",
"model",
",",
"*",
",",
"upsert",
"=",
"None",
")",
":",
"pkname",
"=",
"model",
".",
"primary_key_name",
"include_keys",
"=",
"set",
"(",
"model",
".",
"attrs",
".",
"keys",
"(",
")",
")",
".",
"difference",
... | Inserts a record for the given model.
If model's primary key is auto, the primary key will be set appropriately. | [
"Inserts",
"a",
"record",
"for",
"the",
"given",
"model",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L97-L135 |
249,208 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.delete_model | def delete_model(self, model_or_type, id_=None):
"""Deletes a model.
:model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be
specified, and the associated record is deleted.
"""
if not id_:
constraints = get_model_id_constraints(model_or_type)
else:
... | python | def delete_model(self, model_or_type, id_=None):
"""Deletes a model.
:model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be
specified, and the associated record is deleted.
"""
if not id_:
constraints = get_model_id_constraints(model_or_type)
else:
... | [
"def",
"delete_model",
"(",
"self",
",",
"model_or_type",
",",
"id_",
"=",
"None",
")",
":",
"if",
"not",
"id_",
":",
"constraints",
"=",
"get_model_id_constraints",
"(",
"model_or_type",
")",
"else",
":",
"constraints",
"=",
"get_id_constraints",
"(",
"model_... | Deletes a model.
:model_or_type: if a model, delete that model. If it is a ModelBase subclass, id_ must be
specified, and the associated record is deleted. | [
"Deletes",
"a",
"model",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L137-L149 |
249,209 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_or_build | def find_or_build(self, constructor, props):
"""Looks for a model that matches the given dictionary constraints. If it is not found, a new
model of the given type is constructed and returned.
"""
model = self.find_model(constructor, props)
return model or constructor(**props) | python | def find_or_build(self, constructor, props):
"""Looks for a model that matches the given dictionary constraints. If it is not found, a new
model of the given type is constructed and returned.
"""
model = self.find_model(constructor, props)
return model or constructor(**props) | [
"def",
"find_or_build",
"(",
"self",
",",
"constructor",
",",
"props",
")",
":",
"model",
"=",
"self",
".",
"find_model",
"(",
"constructor",
",",
"props",
")",
"return",
"model",
"or",
"constructor",
"(",
"*",
"*",
"props",
")"
] | Looks for a model that matches the given dictionary constraints. If it is not found, a new
model of the given type is constructed and returned. | [
"Looks",
"for",
"a",
"model",
"that",
"matches",
"the",
"given",
"dictionary",
"constraints",
".",
"If",
"it",
"is",
"not",
"found",
"a",
"new",
"model",
"of",
"the",
"given",
"type",
"is",
"constructed",
"and",
"returned",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L151-L156 |
249,210 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_or_create | def find_or_create(self, constructor, props, *, comp=None):
"""Looks for a model taht matches the given dictionary constraints. If it is not found, a new
model of the given type is created and saved to the database, then returned.
"""
model = self.find_model(constructor, comp or props)
if model is N... | python | def find_or_create(self, constructor, props, *, comp=None):
"""Looks for a model taht matches the given dictionary constraints. If it is not found, a new
model of the given type is created and saved to the database, then returned.
"""
model = self.find_model(constructor, comp or props)
if model is N... | [
"def",
"find_or_create",
"(",
"self",
",",
"constructor",
",",
"props",
",",
"*",
",",
"comp",
"=",
"None",
")",
":",
"model",
"=",
"self",
".",
"find_model",
"(",
"constructor",
",",
"comp",
"or",
"props",
")",
"if",
"model",
"is",
"None",
":",
"mod... | Looks for a model taht matches the given dictionary constraints. If it is not found, a new
model of the given type is created and saved to the database, then returned. | [
"Looks",
"for",
"a",
"model",
"taht",
"matches",
"the",
"given",
"dictionary",
"constraints",
".",
"If",
"it",
"is",
"not",
"found",
"a",
"new",
"model",
"of",
"the",
"given",
"type",
"is",
"created",
"and",
"saved",
"to",
"the",
"database",
"then",
"ret... | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L158-L166 |
249,211 | treycucco/bidon | bidon/db/access/model_access.py | ModelAccess.find_or_upsert | def find_or_upsert(self, constructor, props, *, comp=None, return_status=False):
"""This finds or upserts a model with an auto primary key, and is a bit more flexible than
find_or_create.
First it looks for the model matching either comp, or props if comp is None.
If not found, it will try to upsert t... | python | def find_or_upsert(self, constructor, props, *, comp=None, return_status=False):
"""This finds or upserts a model with an auto primary key, and is a bit more flexible than
find_or_create.
First it looks for the model matching either comp, or props if comp is None.
If not found, it will try to upsert t... | [
"def",
"find_or_upsert",
"(",
"self",
",",
"constructor",
",",
"props",
",",
"*",
",",
"comp",
"=",
"None",
",",
"return_status",
"=",
"False",
")",
":",
"model",
"=",
"self",
".",
"find_model",
"(",
"constructor",
",",
"comp",
"or",
"props",
")",
"sta... | This finds or upserts a model with an auto primary key, and is a bit more flexible than
find_or_create.
First it looks for the model matching either comp, or props if comp is None.
If not found, it will try to upsert the model, doing nothing. If the returned model is new,
meaning it's primary key is n... | [
"This",
"finds",
"or",
"upserts",
"a",
"model",
"with",
"an",
"auto",
"primary",
"key",
"and",
"is",
"a",
"bit",
"more",
"flexible",
"than",
"find_or_create",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/db/access/model_access.py#L168-L205 |
249,212 | naphatkrit/easyci | easyci/vcs/base.py | Vcs.temp_copy | def temp_copy(self):
"""Yields a new Vcs object that represents a temporary, disposable
copy of the current repository. The copy is deleted at the end
of the context.
The following are not copied:
- ignored files
- easyci private directory (.git/eci for git)
Yie... | python | def temp_copy(self):
"""Yields a new Vcs object that represents a temporary, disposable
copy of the current repository. The copy is deleted at the end
of the context.
The following are not copied:
- ignored files
- easyci private directory (.git/eci for git)
Yie... | [
"def",
"temp_copy",
"(",
"self",
")",
":",
"with",
"contextmanagers",
".",
"temp_dir",
"(",
")",
"as",
"temp_dir",
":",
"temp_root_path",
"=",
"os",
".",
"path",
".",
"join",
"(",
"temp_dir",
",",
"'root'",
")",
"path",
"=",
"os",
".",
"path",
".",
"... | Yields a new Vcs object that represents a temporary, disposable
copy of the current repository. The copy is deleted at the end
of the context.
The following are not copied:
- ignored files
- easyci private directory (.git/eci for git)
Yields:
Vcs | [
"Yields",
"a",
"new",
"Vcs",
"object",
"that",
"represents",
"a",
"temporary",
"disposable",
"copy",
"of",
"the",
"current",
"repository",
".",
"The",
"copy",
"is",
"deleted",
"at",
"the",
"end",
"of",
"the",
"context",
"."
] | 7aee8d7694fe4e2da42ce35b0f700bc840c8b95f | https://github.com/naphatkrit/easyci/blob/7aee8d7694fe4e2da42ce35b0f700bc840c8b95f/easyci/vcs/base.py#L185-L203 |
249,213 | minhhoit/yacms | yacms/pages/managers.py | PageManager.published | def published(self, for_user=None, include_login_required=False):
"""
Override ``DisplayableManager.published`` to exclude
pages with ``login_required`` set to ``True``. if the
user is unauthenticated and the setting
``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``.
... | python | def published(self, for_user=None, include_login_required=False):
"""
Override ``DisplayableManager.published`` to exclude
pages with ``login_required`` set to ``True``. if the
user is unauthenticated and the setting
``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``.
... | [
"def",
"published",
"(",
"self",
",",
"for_user",
"=",
"None",
",",
"include_login_required",
"=",
"False",
")",
":",
"published",
"=",
"super",
"(",
"PageManager",
",",
"self",
")",
".",
"published",
"(",
"for_user",
"=",
"for_user",
")",
"unauthenticated",... | Override ``DisplayableManager.published`` to exclude
pages with ``login_required`` set to ``True``. if the
user is unauthenticated and the setting
``PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED`` is ``False``.
The extra ``include_login_required`` arg allows callers to
override the ``P... | [
"Override",
"DisplayableManager",
".",
"published",
"to",
"exclude",
"pages",
"with",
"login_required",
"set",
"to",
"True",
".",
"if",
"the",
"user",
"is",
"unauthenticated",
"and",
"the",
"setting",
"PAGES_PUBLISHED_INCLUDE_LOGIN_REQUIRED",
"is",
"False",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/pages/managers.py#L11-L29 |
249,214 | stevemarple/python-atomiccreate | atomiccreate/__init__.py | atomic_symlink | def atomic_symlink(src, dst):
"""Create or update a symbolic link atomically.
This function is similar to :py:func:`os.symlink` but will update a symlink atomically."""
dst_dir = os.path.dirname(dst)
tmp = None
max_tries = getattr(os, 'TMP_MAX', 10000)
try:
if not os.path.exists(dst_d... | python | def atomic_symlink(src, dst):
"""Create or update a symbolic link atomically.
This function is similar to :py:func:`os.symlink` but will update a symlink atomically."""
dst_dir = os.path.dirname(dst)
tmp = None
max_tries = getattr(os, 'TMP_MAX', 10000)
try:
if not os.path.exists(dst_d... | [
"def",
"atomic_symlink",
"(",
"src",
",",
"dst",
")",
":",
"dst_dir",
"=",
"os",
".",
"path",
".",
"dirname",
"(",
"dst",
")",
"tmp",
"=",
"None",
"max_tries",
"=",
"getattr",
"(",
"os",
",",
"'TMP_MAX'",
",",
"10000",
")",
"try",
":",
"if",
"not",... | Create or update a symbolic link atomically.
This function is similar to :py:func:`os.symlink` but will update a symlink atomically. | [
"Create",
"or",
"update",
"a",
"symbolic",
"link",
"atomically",
"."
] | 33bbbe8ce706dbd5f89ef3e4e29609d51e5fb39a | https://github.com/stevemarple/python-atomiccreate/blob/33bbbe8ce706dbd5f89ef3e4e29609d51e5fb39a/atomiccreate/__init__.py#L114-L146 |
249,215 | msuozzo/Aduro | main.py | run | def run(): #pylint: disable=too-many-locals
"""Execute the command loop
"""
store = EventStore(STORE_PATH)
with open(CREDENTIAL_PATH, 'r') as cred_file:
creds = json.load(cred_file)
uname, pword = creds['uname'], creds['pword']
mgr = KindleProgressMgr(store, uname, pword)
print... | python | def run(): #pylint: disable=too-many-locals
"""Execute the command loop
"""
store = EventStore(STORE_PATH)
with open(CREDENTIAL_PATH, 'r') as cred_file:
creds = json.load(cred_file)
uname, pword = creds['uname'], creds['pword']
mgr = KindleProgressMgr(store, uname, pword)
print... | [
"def",
"run",
"(",
")",
":",
"#pylint: disable=too-many-locals",
"store",
"=",
"EventStore",
"(",
"STORE_PATH",
")",
"with",
"open",
"(",
"CREDENTIAL_PATH",
",",
"'r'",
")",
"as",
"cred_file",
":",
"creds",
"=",
"json",
".",
"load",
"(",
"cred_file",
")",
... | Execute the command loop | [
"Execute",
"the",
"command",
"loop"
] | 338eeb1deeff30c198e721b660ae4daca3660911 | https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/main.py#L28-L53 |
249,216 | msuozzo/Aduro | main.py | _change_state_prompt | def _change_state_prompt(mgr):
"""Runs a prompt to change the state of books.
Registers `Event`s with `mgr` as they are requested.
Args:
mgr: A `KindleProgressMgr` object with the `books` and `progress`
fields populated.
"""
cmd = ''
book_range = range(1, len(mgr.books) + 1... | python | def _change_state_prompt(mgr):
"""Runs a prompt to change the state of books.
Registers `Event`s with `mgr` as they are requested.
Args:
mgr: A `KindleProgressMgr` object with the `books` and `progress`
fields populated.
"""
cmd = ''
book_range = range(1, len(mgr.books) + 1... | [
"def",
"_change_state_prompt",
"(",
"mgr",
")",
":",
"cmd",
"=",
"''",
"book_range",
"=",
"range",
"(",
"1",
",",
"len",
"(",
"mgr",
".",
"books",
")",
"+",
"1",
")",
"ind_to_book",
"=",
"dict",
"(",
"zip",
"(",
"book_range",
",",
"mgr",
".",
"book... | Runs a prompt to change the state of books.
Registers `Event`s with `mgr` as they are requested.
Args:
mgr: A `KindleProgressMgr` object with the `books` and `progress`
fields populated. | [
"Runs",
"a",
"prompt",
"to",
"change",
"the",
"state",
"of",
"books",
"."
] | 338eeb1deeff30c198e721b660ae4daca3660911 | https://github.com/msuozzo/Aduro/blob/338eeb1deeff30c198e721b660ae4daca3660911/main.py#L56-L94 |
249,217 | emlazzarin/acrylic | acrylic/ExcelRW.py | UnicodeReader.change_sheet | def change_sheet(self, sheet_name_or_num):
"""
Calling this method changes the sheet in anticipation for the
next time you create an iterator.
If you change the active sheet while iterating on a UnicodeReader
instance, it will continue to iterate correctly until completion.
... | python | def change_sheet(self, sheet_name_or_num):
"""
Calling this method changes the sheet in anticipation for the
next time you create an iterator.
If you change the active sheet while iterating on a UnicodeReader
instance, it will continue to iterate correctly until completion.
... | [
"def",
"change_sheet",
"(",
"self",
",",
"sheet_name_or_num",
")",
":",
"if",
"isinstance",
"(",
"sheet_name_or_num",
",",
"int",
")",
":",
"self",
".",
"_sheet",
"=",
"self",
".",
"__wb",
"[",
"self",
".",
"__wb",
".",
"sheetnames",
"[",
"sheet_name_or_nu... | Calling this method changes the sheet in anticipation for the
next time you create an iterator.
If you change the active sheet while iterating on a UnicodeReader
instance, it will continue to iterate correctly until completion.
The next time you iterate through reader, it will begin all... | [
"Calling",
"this",
"method",
"changes",
"the",
"sheet",
"in",
"anticipation",
"for",
"the",
"next",
"time",
"you",
"create",
"an",
"iterator",
"."
] | 08c6702d73b9660ead1024653f4fa016f6340e46 | https://github.com/emlazzarin/acrylic/blob/08c6702d73b9660ead1024653f4fa016f6340e46/acrylic/ExcelRW.py#L27-L43 |
249,218 | contains-io/containment | containment/builder.py | CommandLineInterface._os_install | def _os_install(self, package_file):
"""
take in a dict return a string of docker build RUN directives
one RUN per package type
one package type per JSON key
"""
packages = " ".join(json.load(package_file.open()))
if packages:
for packager in self.pkg_... | python | def _os_install(self, package_file):
"""
take in a dict return a string of docker build RUN directives
one RUN per package type
one package type per JSON key
"""
packages = " ".join(json.load(package_file.open()))
if packages:
for packager in self.pkg_... | [
"def",
"_os_install",
"(",
"self",
",",
"package_file",
")",
":",
"packages",
"=",
"\" \"",
".",
"join",
"(",
"json",
".",
"load",
"(",
"package_file",
".",
"open",
"(",
")",
")",
")",
"if",
"packages",
":",
"for",
"packager",
"in",
"self",
".",
"pkg... | take in a dict return a string of docker build RUN directives
one RUN per package type
one package type per JSON key | [
"take",
"in",
"a",
"dict",
"return",
"a",
"string",
"of",
"docker",
"build",
"RUN",
"directives",
"one",
"RUN",
"per",
"package",
"type",
"one",
"package",
"type",
"per",
"JSON",
"key"
] | 4f7e2c2338e0ca7c107a7b3a9913bb5e6e07245f | https://github.com/contains-io/containment/blob/4f7e2c2338e0ca7c107a7b3a9913bb5e6e07245f/containment/builder.py#L65-L78 |
249,219 | anti1869/sunhead | src/sunhead/events/transports/amqp.py | AMQPClient.connect | async def connect(self):
"""
Create new asynchronous connection to the RabbitMQ instance.
This will connect, declare exchange and bind itself to the configured queue.
After that, client is ready to publish or consume messages.
:return: Does not return anything.
"""
... | python | async def connect(self):
"""
Create new asynchronous connection to the RabbitMQ instance.
This will connect, declare exchange and bind itself to the configured queue.
After that, client is ready to publish or consume messages.
:return: Does not return anything.
"""
... | [
"async",
"def",
"connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"connected",
"or",
"self",
".",
"is_connecting",
":",
"return",
"self",
".",
"_is_connecting",
"=",
"True",
"try",
":",
"logger",
".",
"info",
"(",
"\"Connecting to RabbitMQ...\"",
")",
"... | Create new asynchronous connection to the RabbitMQ instance.
This will connect, declare exchange and bind itself to the configured queue.
After that, client is ready to publish or consume messages.
:return: Does not return anything. | [
"Create",
"new",
"asynchronous",
"connection",
"to",
"the",
"RabbitMQ",
"instance",
".",
"This",
"will",
"connect",
"declare",
"exchange",
"and",
"bind",
"itself",
"to",
"the",
"configured",
"queue",
"."
] | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/events/transports/amqp.py#L87-L119 |
249,220 | anti1869/sunhead | src/sunhead/events/transports/amqp.py | AMQPClient.consume_queue | async def consume_queue(self, subscriber: AbstractSubscriber) -> None:
"""
Subscribe to the queue consuming.
:param subscriber:
:return:
"""
queue_name = subscriber.name
topics = subscriber.requested_topics
if queue_name in self._known_queues:
... | python | async def consume_queue(self, subscriber: AbstractSubscriber) -> None:
"""
Subscribe to the queue consuming.
:param subscriber:
:return:
"""
queue_name = subscriber.name
topics = subscriber.requested_topics
if queue_name in self._known_queues:
... | [
"async",
"def",
"consume_queue",
"(",
"self",
",",
"subscriber",
":",
"AbstractSubscriber",
")",
"->",
"None",
":",
"queue_name",
"=",
"subscriber",
".",
"name",
"topics",
"=",
"subscriber",
".",
"requested_topics",
"if",
"queue_name",
"in",
"self",
".",
"_kno... | Subscribe to the queue consuming.
:param subscriber:
:return: | [
"Subscribe",
"to",
"the",
"queue",
"consuming",
"."
] | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/events/transports/amqp.py#L140-L171 |
249,221 | anti1869/sunhead | src/sunhead/events/transports/amqp.py | AMQPClient._bind_key_to_queue | async def _bind_key_to_queue(self, routing_key: AnyStr, queue_name: AnyStr) -> None:
"""
Bind to queue with specified routing key.
:param routing_key: Routing key to bind with.
:param queue_name: Name of the queue
:return: Does not return anything
"""
logger.info... | python | async def _bind_key_to_queue(self, routing_key: AnyStr, queue_name: AnyStr) -> None:
"""
Bind to queue with specified routing key.
:param routing_key: Routing key to bind with.
:param queue_name: Name of the queue
:return: Does not return anything
"""
logger.info... | [
"async",
"def",
"_bind_key_to_queue",
"(",
"self",
",",
"routing_key",
":",
"AnyStr",
",",
"queue_name",
":",
"AnyStr",
")",
"->",
"None",
":",
"logger",
".",
"info",
"(",
"\"Binding key='%s'\"",
",",
"routing_key",
")",
"result",
"=",
"await",
"self",
".",
... | Bind to queue with specified routing key.
:param routing_key: Routing key to bind with.
:param queue_name: Name of the queue
:return: Does not return anything | [
"Bind",
"to",
"queue",
"with",
"specified",
"routing",
"key",
"."
] | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/events/transports/amqp.py#L179-L194 |
249,222 | anti1869/sunhead | src/sunhead/events/transports/amqp.py | AMQPClient._on_message | async def _on_message(self, channel, body, envelope, properties) -> None:
"""
Fires up when message is received by this consumer.
:param channel: Channel, through which message is received
:param body: Body of the message (serialized).
:param envelope: Envelope object with messa... | python | async def _on_message(self, channel, body, envelope, properties) -> None:
"""
Fires up when message is received by this consumer.
:param channel: Channel, through which message is received
:param body: Body of the message (serialized).
:param envelope: Envelope object with messa... | [
"async",
"def",
"_on_message",
"(",
"self",
",",
"channel",
",",
"body",
",",
"envelope",
",",
"properties",
")",
"->",
"None",
":",
"subscribers",
"=",
"self",
".",
"_get_subscribers",
"(",
"envelope",
".",
"routing_key",
")",
"if",
"not",
"subscribers",
... | Fires up when message is received by this consumer.
:param channel: Channel, through which message is received
:param body: Body of the message (serialized).
:param envelope: Envelope object with message meta
:type envelope: aioamqp.Envelope
:param properties: Properties of the ... | [
"Fires",
"up",
"when",
"message",
"is",
"received",
"by",
"this",
"consumer",
"."
] | 5117ec797a38eb82d955241d20547d125efe80f3 | https://github.com/anti1869/sunhead/blob/5117ec797a38eb82d955241d20547d125efe80f3/src/sunhead/events/transports/amqp.py#L196-L219 |
249,223 | bertrandvidal/parse_this | parse_this/__init__.py | parse_this | def parse_this(func, types, args=None, delimiter_chars=":"):
"""Create an ArgParser for the given function converting the command line
arguments according to the list of types.
Args:
func: the function for which the command line arguments to be parsed
types: a list of types - as accepted... | python | def parse_this(func, types, args=None, delimiter_chars=":"):
"""Create an ArgParser for the given function converting the command line
arguments according to the list of types.
Args:
func: the function for which the command line arguments to be parsed
types: a list of types - as accepted... | [
"def",
"parse_this",
"(",
"func",
",",
"types",
",",
"args",
"=",
"None",
",",
"delimiter_chars",
"=",
"\":\"",
")",
":",
"_LOG",
".",
"debug",
"(",
"\"Creating parser for %s\"",
",",
"func",
".",
"__name__",
")",
"(",
"func_args",
",",
"dummy_1",
",",
"... | Create an ArgParser for the given function converting the command line
arguments according to the list of types.
Args:
func: the function for which the command line arguments to be parsed
types: a list of types - as accepted by argparse - that will be used to
convert the command ... | [
"Create",
"an",
"ArgParser",
"for",
"the",
"given",
"function",
"converting",
"the",
"command",
"line",
"arguments",
"according",
"to",
"the",
"list",
"of",
"types",
"."
] | aa2e3737f19642300ef1ca65cae21c90049718a2 | https://github.com/bertrandvidal/parse_this/blob/aa2e3737f19642300ef1ca65cae21c90049718a2/parse_this/__init__.py#L19-L37 |
249,224 | bertrandvidal/parse_this | parse_this/__init__.py | parse_class._add_sub_parsers | def _add_sub_parsers(self, top_level_parser, methods_to_parse, class_name):
"""Add all the sub-parsers to the top_level_parser.
Args:
top_level_parser: the top level parser
methods_to_parse: dict of method name pointing to their associated
argument parser
... | python | def _add_sub_parsers(self, top_level_parser, methods_to_parse, class_name):
"""Add all the sub-parsers to the top_level_parser.
Args:
top_level_parser: the top level parser
methods_to_parse: dict of method name pointing to their associated
argument parser
... | [
"def",
"_add_sub_parsers",
"(",
"self",
",",
"top_level_parser",
",",
"methods_to_parse",
",",
"class_name",
")",
":",
"description",
"=",
"\"Accessible methods of {}\"",
".",
"format",
"(",
"class_name",
")",
"sub_parsers",
"=",
"top_level_parser",
".",
"add_subparse... | Add all the sub-parsers to the top_level_parser.
Args:
top_level_parser: the top level parser
methods_to_parse: dict of method name pointing to their associated
argument parser
class_name: name of the decorated class
Returns:
a dict of regist... | [
"Add",
"all",
"the",
"sub",
"-",
"parsers",
"to",
"the",
"top_level_parser",
"."
] | aa2e3737f19642300ef1ca65cae21c90049718a2 | https://github.com/bertrandvidal/parse_this/blob/aa2e3737f19642300ef1ca65cae21c90049718a2/parse_this/__init__.py#L119-L157 |
249,225 | bertrandvidal/parse_this | parse_this/__init__.py | parse_class._set_class_parser | def _set_class_parser(self, init_parser, methods_to_parse, cls):
"""Creates the complete argument parser for the decorated class.
Args:
init_parser: argument parser for the __init__ method or None
methods_to_parse: dict of method name pointing to their associated
arg... | python | def _set_class_parser(self, init_parser, methods_to_parse, cls):
"""Creates the complete argument parser for the decorated class.
Args:
init_parser: argument parser for the __init__ method or None
methods_to_parse: dict of method name pointing to their associated
arg... | [
"def",
"_set_class_parser",
"(",
"self",
",",
"init_parser",
",",
"methods_to_parse",
",",
"cls",
")",
":",
"top_level_parents",
"=",
"[",
"init_parser",
"]",
"if",
"init_parser",
"else",
"[",
"]",
"description",
"=",
"self",
".",
"_description",
"or",
"cls",
... | Creates the complete argument parser for the decorated class.
Args:
init_parser: argument parser for the __init__ method or None
methods_to_parse: dict of method name pointing to their associated
argument parser
cls: the class we are decorating
Returns:
... | [
"Creates",
"the",
"complete",
"argument",
"parser",
"for",
"the",
"decorated",
"class",
"."
] | aa2e3737f19642300ef1ca65cae21c90049718a2 | https://github.com/bertrandvidal/parse_this/blob/aa2e3737f19642300ef1ca65cae21c90049718a2/parse_this/__init__.py#L159-L187 |
249,226 | bertrandvidal/parse_this | parse_this/__init__.py | parse_class._get_parser_call_method | def _get_parser_call_method(self, parser_to_method):
"""Return the parser special method 'call' that handles sub-command
calling.
Args:
parser_to_method: mapping of the parser registered name
to the method it is linked to
"""
def inner_call(args=None,... | python | def _get_parser_call_method(self, parser_to_method):
"""Return the parser special method 'call' that handles sub-command
calling.
Args:
parser_to_method: mapping of the parser registered name
to the method it is linked to
"""
def inner_call(args=None,... | [
"def",
"_get_parser_call_method",
"(",
"self",
",",
"parser_to_method",
")",
":",
"def",
"inner_call",
"(",
"args",
"=",
"None",
",",
"instance",
"=",
"None",
")",
":",
"\"\"\"Allows to call the method invoked from the command line or\n provided argument.\n\n ... | Return the parser special method 'call' that handles sub-command
calling.
Args:
parser_to_method: mapping of the parser registered name
to the method it is linked to | [
"Return",
"the",
"parser",
"special",
"method",
"call",
"that",
"handles",
"sub",
"-",
"command",
"calling",
"."
] | aa2e3737f19642300ef1ca65cae21c90049718a2 | https://github.com/bertrandvidal/parse_this/blob/aa2e3737f19642300ef1ca65cae21c90049718a2/parse_this/__init__.py#L189-L225 |
249,227 | tschaume/ccsgp_get_started | ccsgp_get_started/examples/gp_lcltpt.py | gp_lcltpt | def gp_lcltpt():
""" example plot to display linecolors, linetypes and pointtypes
.. image:: pics/gp_lcltpt.png
:width: 450 px
"""
inDir, outDir = getWorkDirs()
nSets = len(default_colors)
make_plot(
data = [
np.array([ [0,i,0,0,0], [1,i,0,0,0] ])
for i in xrange(nSets)
],
prop... | python | def gp_lcltpt():
""" example plot to display linecolors, linetypes and pointtypes
.. image:: pics/gp_lcltpt.png
:width: 450 px
"""
inDir, outDir = getWorkDirs()
nSets = len(default_colors)
make_plot(
data = [
np.array([ [0,i,0,0,0], [1,i,0,0,0] ])
for i in xrange(nSets)
],
prop... | [
"def",
"gp_lcltpt",
"(",
")",
":",
"inDir",
",",
"outDir",
"=",
"getWorkDirs",
"(",
")",
"nSets",
"=",
"len",
"(",
"default_colors",
")",
"make_plot",
"(",
"data",
"=",
"[",
"np",
".",
"array",
"(",
"[",
"[",
"0",
",",
"i",
",",
"0",
",",
"0",
... | example plot to display linecolors, linetypes and pointtypes
.. image:: pics/gp_lcltpt.png
:width: 450 px | [
"example",
"plot",
"to",
"display",
"linecolors",
"linetypes",
"and",
"pointtypes"
] | e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2 | https://github.com/tschaume/ccsgp_get_started/blob/e4e29844a3e6fc7574e9b4b8cd84131f28ddc3f2/ccsgp_get_started/examples/gp_lcltpt.py#L7-L28 |
249,228 | pjanis/funtool | funtool/api.py | run_analyses | def run_analyses(prepared_analyses=None,log_dir=default_log_dir):
"""
If all defaults are ok, this should be the only function needed to run the analyses.
"""
if prepared_analyses == None:
prepared_analyses = prepare_analyses()
state_collection = funtool.state_collection.StateCollection(... | python | def run_analyses(prepared_analyses=None,log_dir=default_log_dir):
"""
If all defaults are ok, this should be the only function needed to run the analyses.
"""
if prepared_analyses == None:
prepared_analyses = prepare_analyses()
state_collection = funtool.state_collection.StateCollection(... | [
"def",
"run_analyses",
"(",
"prepared_analyses",
"=",
"None",
",",
"log_dir",
"=",
"default_log_dir",
")",
":",
"if",
"prepared_analyses",
"==",
"None",
":",
"prepared_analyses",
"=",
"prepare_analyses",
"(",
")",
"state_collection",
"=",
"funtool",
".",
"state_co... | If all defaults are ok, this should be the only function needed to run the analyses. | [
"If",
"all",
"defaults",
"are",
"ok",
"this",
"should",
"be",
"the",
"only",
"function",
"needed",
"to",
"run",
"the",
"analyses",
"."
] | 231851238f0a62bc3682d8fa937db9053378c53d | https://github.com/pjanis/funtool/blob/231851238f0a62bc3682d8fa937db9053378c53d/funtool/api.py#L98-L107 |
249,229 | pjanis/funtool | funtool/api.py | run_analysis | def run_analysis( named_analysis, prepared_analyses=None,log_dir=default_log_dir):
"""
Runs just the named analysis. Otherwise just like run_analyses
"""
if prepared_analyses == None:
prepared_analyses = prepare_analyses()
state_collection = funtool.state_collection.StateCollection([],{})
... | python | def run_analysis( named_analysis, prepared_analyses=None,log_dir=default_log_dir):
"""
Runs just the named analysis. Otherwise just like run_analyses
"""
if prepared_analyses == None:
prepared_analyses = prepare_analyses()
state_collection = funtool.state_collection.StateCollection([],{})
... | [
"def",
"run_analysis",
"(",
"named_analysis",
",",
"prepared_analyses",
"=",
"None",
",",
"log_dir",
"=",
"default_log_dir",
")",
":",
"if",
"prepared_analyses",
"==",
"None",
":",
"prepared_analyses",
"=",
"prepare_analyses",
"(",
")",
"state_collection",
"=",
"f... | Runs just the named analysis. Otherwise just like run_analyses | [
"Runs",
"just",
"the",
"named",
"analysis",
".",
"Otherwise",
"just",
"like",
"run_analyses"
] | 231851238f0a62bc3682d8fa937db9053378c53d | https://github.com/pjanis/funtool/blob/231851238f0a62bc3682d8fa937db9053378c53d/funtool/api.py#L109-L119 |
249,230 | cirruscluster/cirruscluster | cirruscluster/ext/ansible/runner/poller.py | AsyncPoller.poll | def poll(self):
""" Poll the job status.
Returns the changes in this iteration."""
self.runner.module_name = 'async_status'
self.runner.module_args = "jid=%s" % self.jid
self.runner.pattern = "*"
self.runner.background = 0
self.runner.inventory.restrict_to(s... | python | def poll(self):
""" Poll the job status.
Returns the changes in this iteration."""
self.runner.module_name = 'async_status'
self.runner.module_args = "jid=%s" % self.jid
self.runner.pattern = "*"
self.runner.background = 0
self.runner.inventory.restrict_to(s... | [
"def",
"poll",
"(",
"self",
")",
":",
"self",
".",
"runner",
".",
"module_name",
"=",
"'async_status'",
"self",
".",
"runner",
".",
"module_args",
"=",
"\"jid=%s\"",
"%",
"self",
".",
"jid",
"self",
".",
"runner",
".",
"pattern",
"=",
"\"*\"",
"self",
... | Poll the job status.
Returns the changes in this iteration. | [
"Poll",
"the",
"job",
"status",
"."
] | 977409929dd81322d886425cdced10608117d5d7 | https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/poller.py#L54-L89 |
249,231 | cirruscluster/cirruscluster | cirruscluster/ext/ansible/runner/poller.py | AsyncPoller.wait | def wait(self, seconds, poll_interval):
""" Wait a certain time for job completion, check status every poll_interval. """
# jid is None when all hosts were skipped
if self.jid is None:
return self.results
clock = seconds - poll_interval
while (clock >= 0 and not self... | python | def wait(self, seconds, poll_interval):
""" Wait a certain time for job completion, check status every poll_interval. """
# jid is None when all hosts were skipped
if self.jid is None:
return self.results
clock = seconds - poll_interval
while (clock >= 0 and not self... | [
"def",
"wait",
"(",
"self",
",",
"seconds",
",",
"poll_interval",
")",
":",
"# jid is None when all hosts were skipped",
"if",
"self",
".",
"jid",
"is",
"None",
":",
"return",
"self",
".",
"results",
"clock",
"=",
"seconds",
"-",
"poll_interval",
"while",
"(",... | Wait a certain time for job completion, check status every poll_interval. | [
"Wait",
"a",
"certain",
"time",
"for",
"job",
"completion",
"check",
"status",
"every",
"poll_interval",
"."
] | 977409929dd81322d886425cdced10608117d5d7 | https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/poller.py#L91-L109 |
249,232 | minhhoit/yacms | yacms/core/forms.py | get_edit_form | def get_edit_form(obj, field_names, data=None, files=None):
"""
Returns the in-line editing form for editing a single model field.
"""
# Map these form fields to their types defined in the forms app so
# we can make use of their custom widgets.
from yacms.forms import fields
widget_override... | python | def get_edit_form(obj, field_names, data=None, files=None):
"""
Returns the in-line editing form for editing a single model field.
"""
# Map these form fields to their types defined in the forms app so
# we can make use of their custom widgets.
from yacms.forms import fields
widget_override... | [
"def",
"get_edit_form",
"(",
"obj",
",",
"field_names",
",",
"data",
"=",
"None",
",",
"files",
"=",
"None",
")",
":",
"# Map these form fields to their types defined in the forms app so",
"# we can make use of their custom widgets.",
"from",
"yacms",
".",
"forms",
"impor... | Returns the in-line editing form for editing a single model field. | [
"Returns",
"the",
"in",
"-",
"line",
"editing",
"form",
"for",
"editing",
"a",
"single",
"model",
"field",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/core/forms.py#L107-L155 |
249,233 | polysquare/polysquare-generic-file-linter | polysquarelinter/lint_spelling_only.py | _filter_disabled_regions | def _filter_disabled_regions(contents):
"""Filter regions that are contained in back-ticks."""
contents = list(contents)
in_backticks = False
contents_len = len(contents)
index = 0
while index < contents_len:
character = contents[index]
if character == "`":
# Check ... | python | def _filter_disabled_regions(contents):
"""Filter regions that are contained in back-ticks."""
contents = list(contents)
in_backticks = False
contents_len = len(contents)
index = 0
while index < contents_len:
character = contents[index]
if character == "`":
# Check ... | [
"def",
"_filter_disabled_regions",
"(",
"contents",
")",
":",
"contents",
"=",
"list",
"(",
"contents",
")",
"in_backticks",
"=",
"False",
"contents_len",
"=",
"len",
"(",
"contents",
")",
"index",
"=",
"0",
"while",
"index",
"<",
"contents_len",
":",
"chara... | Filter regions that are contained in back-ticks. | [
"Filter",
"regions",
"that",
"are",
"contained",
"in",
"back",
"-",
"ticks",
"."
] | cfc88771acd3d5551c28fa5d917bb0aeb584c4cc | https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/lint_spelling_only.py#L28-L52 |
249,234 | polysquare/polysquare-generic-file-linter | polysquarelinter/lint_spelling_only.py | spellcheck | def spellcheck(contents, technical_terms=None, spellcheck_cache=None):
"""Run spellcheck on the contents of a file.
:technical_terms: is a path to a file containing a list of "technical"
terms. These may be symbols as collected from files by using
the generic linter or other such symbols. If a symbol-l... | python | def spellcheck(contents, technical_terms=None, spellcheck_cache=None):
"""Run spellcheck on the contents of a file.
:technical_terms: is a path to a file containing a list of "technical"
terms. These may be symbols as collected from files by using
the generic linter or other such symbols. If a symbol-l... | [
"def",
"spellcheck",
"(",
"contents",
",",
"technical_terms",
"=",
"None",
",",
"spellcheck_cache",
"=",
"None",
")",
":",
"contents",
"=",
"spelling",
".",
"filter_nonspellcheckable_tokens",
"(",
"contents",
")",
"contents",
"=",
"_filter_disabled_regions",
"(",
... | Run spellcheck on the contents of a file.
:technical_terms: is a path to a file containing a list of "technical"
terms. These may be symbols as collected from files by using
the generic linter or other such symbols. If a symbol-like term is
used within contents and it does not appear in :technical_term... | [
"Run",
"spellcheck",
"on",
"the",
"contents",
"of",
"a",
"file",
"."
] | cfc88771acd3d5551c28fa5d917bb0aeb584c4cc | https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/lint_spelling_only.py#L55-L79 |
249,235 | polysquare/polysquare-generic-file-linter | polysquarelinter/lint_spelling_only.py | _report_spelling_error | def _report_spelling_error(error, file_path):
"""Report a spelling error."""
line = error.line_offset + 1
code = "file/spelling_error"
description = _SPELLCHECK_MESSAGES[error.error_type].format(error.word)
if error.suggestions is not None:
description = (description +
... | python | def _report_spelling_error(error, file_path):
"""Report a spelling error."""
line = error.line_offset + 1
code = "file/spelling_error"
description = _SPELLCHECK_MESSAGES[error.error_type].format(error.word)
if error.suggestions is not None:
description = (description +
... | [
"def",
"_report_spelling_error",
"(",
"error",
",",
"file_path",
")",
":",
"line",
"=",
"error",
".",
"line_offset",
"+",
"1",
"code",
"=",
"\"file/spelling_error\"",
"description",
"=",
"_SPELLCHECK_MESSAGES",
"[",
"error",
".",
"error_type",
"]",
".",
"format"... | Report a spelling error. | [
"Report",
"a",
"spelling",
"error",
"."
] | cfc88771acd3d5551c28fa5d917bb0aeb584c4cc | https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/lint_spelling_only.py#L115-L128 |
249,236 | polysquare/polysquare-generic-file-linter | polysquarelinter/lint_spelling_only.py | main | def main(arguments=None): # suppress(unused-function)
"""Entry point for the spellcheck linter."""
dictionary_path = os.path.abspath("DICTIONARY")
result = _parse_arguments(arguments)
num_errors = 0
for found_filename in result.files:
file_path = os.path.abspath(found_filename)
wit... | python | def main(arguments=None): # suppress(unused-function)
"""Entry point for the spellcheck linter."""
dictionary_path = os.path.abspath("DICTIONARY")
result = _parse_arguments(arguments)
num_errors = 0
for found_filename in result.files:
file_path = os.path.abspath(found_filename)
wit... | [
"def",
"main",
"(",
"arguments",
"=",
"None",
")",
":",
"# suppress(unused-function)",
"dictionary_path",
"=",
"os",
".",
"path",
".",
"abspath",
"(",
"\"DICTIONARY\"",
")",
"result",
"=",
"_parse_arguments",
"(",
"arguments",
")",
"num_errors",
"=",
"0",
"for... | Entry point for the spellcheck linter. | [
"Entry",
"point",
"for",
"the",
"spellcheck",
"linter",
"."
] | cfc88771acd3d5551c28fa5d917bb0aeb584c4cc | https://github.com/polysquare/polysquare-generic-file-linter/blob/cfc88771acd3d5551c28fa5d917bb0aeb584c4cc/polysquarelinter/lint_spelling_only.py#L131-L165 |
249,237 | sirrice/scorpionsql | scorpionsql/errfunc.py | AggErrFunc.recover | def recover(self, state):
"recompute the actual value, then compare it against the truth"
newval = self.f.recover(state)
return self.errtype(self.value, newval) | python | def recover(self, state):
"recompute the actual value, then compare it against the truth"
newval = self.f.recover(state)
return self.errtype(self.value, newval) | [
"def",
"recover",
"(",
"self",
",",
"state",
")",
":",
"newval",
"=",
"self",
".",
"f",
".",
"recover",
"(",
"state",
")",
"return",
"self",
".",
"errtype",
"(",
"self",
".",
"value",
",",
"newval",
")"
] | recompute the actual value, then compare it against the truth | [
"recompute",
"the",
"actual",
"value",
"then",
"compare",
"it",
"against",
"the",
"truth"
] | baa05b745fae5df3171244c3e32160bd36c99e86 | https://github.com/sirrice/scorpionsql/blob/baa05b745fae5df3171244c3e32160bd36c99e86/scorpionsql/errfunc.py#L182-L185 |
249,238 | xtrementl/focus | focus/version.py | compare_version | def compare_version(value):
""" Determines if the provided version value compares with program version.
`value`
Version comparison string (e.g. ==1.0, <=1.0, >1.1)
Supported operators:
<, <=, ==, >, >=
"""
# extract parts from value
import re... | python | def compare_version(value):
""" Determines if the provided version value compares with program version.
`value`
Version comparison string (e.g. ==1.0, <=1.0, >1.1)
Supported operators:
<, <=, ==, >, >=
"""
# extract parts from value
import re... | [
"def",
"compare_version",
"(",
"value",
")",
":",
"# extract parts from value",
"import",
"re",
"res",
"=",
"re",
".",
"match",
"(",
"r'(<|<=|==|>|>=)(\\d{1,2}\\.\\d{1,2}(\\.\\d{1,2})?)$'",
",",
"str",
"(",
"value",
")",
".",
"strip",
"(",
")",
")",
"if",
"not",... | Determines if the provided version value compares with program version.
`value`
Version comparison string (e.g. ==1.0, <=1.0, >1.1)
Supported operators:
<, <=, ==, >, >= | [
"Determines",
"if",
"the",
"provided",
"version",
"value",
"compares",
"with",
"program",
"version",
"."
] | cbbbc0b49a7409f9e0dc899de5b7e057f50838e4 | https://github.com/xtrementl/focus/blob/cbbbc0b49a7409f9e0dc899de5b7e057f50838e4/focus/version.py#L8-L46 |
249,239 | edeposit/edeposit.amqp.harvester | src/edeposit/amqp/harvester/__init__.py | get_all_publications | def get_all_publications(return_namedtuples=True):
"""
Get list publications from all available source.
Args:
return_namedtuples (bool, default True): Convert :class:`.Publication`
structures to namedtuples (used in AMQP
communication).
Ret... | python | def get_all_publications(return_namedtuples=True):
"""
Get list publications from all available source.
Args:
return_namedtuples (bool, default True): Convert :class:`.Publication`
structures to namedtuples (used in AMQP
communication).
Ret... | [
"def",
"get_all_publications",
"(",
"return_namedtuples",
"=",
"True",
")",
":",
"sources",
"=",
"[",
"ben_cz",
".",
"get_publications",
",",
"grada_cz",
".",
"get_publications",
",",
"cpress_cz",
".",
"get_publications",
",",
"zonerpress_cz",
".",
"get_publications... | Get list publications from all available source.
Args:
return_namedtuples (bool, default True): Convert :class:`.Publication`
structures to namedtuples (used in AMQP
communication).
Returns:
list: List of :class:`.Publication` structures co... | [
"Get",
"list",
"publications",
"from",
"all",
"available",
"source",
"."
] | 38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e | https://github.com/edeposit/edeposit.amqp.harvester/blob/38cb87ccdf6bf2f550a98460d0a329c4b9dc8e2e/src/edeposit/amqp/harvester/__init__.py#L16-L46 |
249,240 | treycucco/bidon | bidon/spreadsheet/open_document.py | OpenDocumentWorksheet.parse_cell | def parse_cell(self, cell, coords, cell_mode=CellMode.cooked):
"""Parses a cell according to its cell.value_type."""
# pylint: disable=too-many-return-statements
if cell_mode == CellMode.cooked:
if cell.covered or cell.value_type is None or cell.value is None:
return None
vtype = cell.v... | python | def parse_cell(self, cell, coords, cell_mode=CellMode.cooked):
"""Parses a cell according to its cell.value_type."""
# pylint: disable=too-many-return-statements
if cell_mode == CellMode.cooked:
if cell.covered or cell.value_type is None or cell.value is None:
return None
vtype = cell.v... | [
"def",
"parse_cell",
"(",
"self",
",",
"cell",
",",
"coords",
",",
"cell_mode",
"=",
"CellMode",
".",
"cooked",
")",
":",
"# pylint: disable=too-many-return-statements",
"if",
"cell_mode",
"==",
"CellMode",
".",
"cooked",
":",
"if",
"cell",
".",
"covered",
"or... | Parses a cell according to its cell.value_type. | [
"Parses",
"a",
"cell",
"according",
"to",
"its",
"cell",
".",
"value_type",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/spreadsheet/open_document.py#L28-L59 |
249,241 | treycucco/bidon | bidon/spreadsheet/open_document.py | OpenDocumentWorksheet.get_row | def get_row(self, row_index):
"""Returns the row at row_index."""
if self._raw_rows is None:
self._raw_rows = list(self.raw_sheet.rows())
return self._raw_rows[row_index] | python | def get_row(self, row_index):
"""Returns the row at row_index."""
if self._raw_rows is None:
self._raw_rows = list(self.raw_sheet.rows())
return self._raw_rows[row_index] | [
"def",
"get_row",
"(",
"self",
",",
"row_index",
")",
":",
"if",
"self",
".",
"_raw_rows",
"is",
"None",
":",
"self",
".",
"_raw_rows",
"=",
"list",
"(",
"self",
".",
"raw_sheet",
".",
"rows",
"(",
")",
")",
"return",
"self",
".",
"_raw_rows",
"[",
... | Returns the row at row_index. | [
"Returns",
"the",
"row",
"at",
"row_index",
"."
] | d9f24596841d0e69e8ac70a1d1a1deecea95e340 | https://github.com/treycucco/bidon/blob/d9f24596841d0e69e8ac70a1d1a1deecea95e340/bidon/spreadsheet/open_document.py#L61-L65 |
249,242 | slarse/pdfebc-core | pdfebc_core/config_utils.py | create_config | def create_config(sections, section_contents):
"""Create a config file from the provided sections and key value pairs.
Args:
sections (List[str]): A list of section keys.
key_value_pairs (Dict[str, str]): A list of of dictionaries. Must be as long as
the list of sections. That is to say... | python | def create_config(sections, section_contents):
"""Create a config file from the provided sections and key value pairs.
Args:
sections (List[str]): A list of section keys.
key_value_pairs (Dict[str, str]): A list of of dictionaries. Must be as long as
the list of sections. That is to say... | [
"def",
"create_config",
"(",
"sections",
",",
"section_contents",
")",
":",
"sections_length",
",",
"section_contents_length",
"=",
"len",
"(",
"sections",
")",
",",
"len",
"(",
"section_contents",
")",
"if",
"sections_length",
"!=",
"section_contents_length",
":",
... | Create a config file from the provided sections and key value pairs.
Args:
sections (List[str]): A list of section keys.
key_value_pairs (Dict[str, str]): A list of of dictionaries. Must be as long as
the list of sections. That is to say, if there are two sections, there should be two
... | [
"Create",
"a",
"config",
"file",
"from",
"the",
"provided",
"sections",
"and",
"key",
"value",
"pairs",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L56-L78 |
249,243 | slarse/pdfebc-core | pdfebc_core/config_utils.py | write_config | def write_config(config, config_path=CONFIG_PATH):
"""Write the config to the output path.
Creates the necessary directories if they aren't there.
Args:
config (configparser.ConfigParser): A ConfigParser.
"""
if not os.path.exists(config_path):
os.makedirs(os.path.dirname(config_pat... | python | def write_config(config, config_path=CONFIG_PATH):
"""Write the config to the output path.
Creates the necessary directories if they aren't there.
Args:
config (configparser.ConfigParser): A ConfigParser.
"""
if not os.path.exists(config_path):
os.makedirs(os.path.dirname(config_pat... | [
"def",
"write_config",
"(",
"config",
",",
"config_path",
"=",
"CONFIG_PATH",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"exists",
"(",
"config_path",
")",
":",
"os",
".",
"makedirs",
"(",
"os",
".",
"path",
".",
"dirname",
"(",
"config_path",
")",... | Write the config to the output path.
Creates the necessary directories if they aren't there.
Args:
config (configparser.ConfigParser): A ConfigParser. | [
"Write",
"the",
"config",
"to",
"the",
"output",
"path",
".",
"Creates",
"the",
"necessary",
"directories",
"if",
"they",
"aren",
"t",
"there",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L80-L90 |
249,244 | slarse/pdfebc-core | pdfebc_core/config_utils.py | read_config | def read_config(config_path=CONFIG_PATH):
"""Read the config information from the config file.
Args:
config_path (str): Relative path to the email config file.
Returns:
defaultdict: A defaultdict with the config information.
Raises:
IOError
"""
if not os.path.isfile(conf... | python | def read_config(config_path=CONFIG_PATH):
"""Read the config information from the config file.
Args:
config_path (str): Relative path to the email config file.
Returns:
defaultdict: A defaultdict with the config information.
Raises:
IOError
"""
if not os.path.isfile(conf... | [
"def",
"read_config",
"(",
"config_path",
"=",
"CONFIG_PATH",
")",
":",
"if",
"not",
"os",
".",
"path",
".",
"isfile",
"(",
"config_path",
")",
":",
"raise",
"IOError",
"(",
"\"No config file found at %s\"",
"%",
"config_path",
")",
"config_parser",
"=",
"conf... | Read the config information from the config file.
Args:
config_path (str): Relative path to the email config file.
Returns:
defaultdict: A defaultdict with the config information.
Raises:
IOError | [
"Read",
"the",
"config",
"information",
"from",
"the",
"config",
"file",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L92-L107 |
249,245 | slarse/pdfebc-core | pdfebc_core/config_utils.py | check_config | def check_config(config):
"""Check that all sections of the config contain the keys that they should.
Args:
config (defaultdict): A defaultdict.
Raises:
ConfigurationError
"""
for section, expected_section_keys in SECTION_KEYS.items():
section_content = config.get(section)
... | python | def check_config(config):
"""Check that all sections of the config contain the keys that they should.
Args:
config (defaultdict): A defaultdict.
Raises:
ConfigurationError
"""
for section, expected_section_keys in SECTION_KEYS.items():
section_content = config.get(section)
... | [
"def",
"check_config",
"(",
"config",
")",
":",
"for",
"section",
",",
"expected_section_keys",
"in",
"SECTION_KEYS",
".",
"items",
"(",
")",
":",
"section_content",
"=",
"config",
".",
"get",
"(",
"section",
")",
"if",
"not",
"section_content",
":",
"raise"... | Check that all sections of the config contain the keys that they should.
Args:
config (defaultdict): A defaultdict.
Raises:
ConfigurationError | [
"Check",
"that",
"all",
"sections",
"of",
"the",
"config",
"contain",
"the",
"keys",
"that",
"they",
"should",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L109-L124 |
249,246 | slarse/pdfebc-core | pdfebc_core/config_utils.py | run_config_diagnostics | def run_config_diagnostics(config_path=CONFIG_PATH):
"""Run diagnostics on the configuration file.
Args:
config_path (str): Path to the configuration file.
Returns:
str, Set[str], dict(str, Set[str]): The path to the configuration file, a set of missing
sections and a dict that maps... | python | def run_config_diagnostics(config_path=CONFIG_PATH):
"""Run diagnostics on the configuration file.
Args:
config_path (str): Path to the configuration file.
Returns:
str, Set[str], dict(str, Set[str]): The path to the configuration file, a set of missing
sections and a dict that maps... | [
"def",
"run_config_diagnostics",
"(",
"config_path",
"=",
"CONFIG_PATH",
")",
":",
"config",
"=",
"read_config",
"(",
"config_path",
")",
"missing_sections",
"=",
"set",
"(",
")",
"malformed_entries",
"=",
"defaultdict",
"(",
"set",
")",
"for",
"section",
",",
... | Run diagnostics on the configuration file.
Args:
config_path (str): Path to the configuration file.
Returns:
str, Set[str], dict(str, Set[str]): The path to the configuration file, a set of missing
sections and a dict that maps each section to the entries that have either missing or emp... | [
"Run",
"diagnostics",
"on",
"the",
"configuration",
"file",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L126-L148 |
249,247 | slarse/pdfebc-core | pdfebc_core/config_utils.py | get_attribute_from_config | def get_attribute_from_config(config, section, attribute):
"""Try to parse an attribute of the config file.
Args:
config (defaultdict): A defaultdict.
section (str): The section of the config file to get information from.
attribute (str): The attribute of the section to fetch.
Retur... | python | def get_attribute_from_config(config, section, attribute):
"""Try to parse an attribute of the config file.
Args:
config (defaultdict): A defaultdict.
section (str): The section of the config file to get information from.
attribute (str): The attribute of the section to fetch.
Retur... | [
"def",
"get_attribute_from_config",
"(",
"config",
",",
"section",
",",
"attribute",
")",
":",
"section",
"=",
"config",
".",
"get",
"(",
"section",
")",
"if",
"section",
":",
"option",
"=",
"section",
".",
"get",
"(",
"attribute",
")",
"if",
"option",
"... | Try to parse an attribute of the config file.
Args:
config (defaultdict): A defaultdict.
section (str): The section of the config file to get information from.
attribute (str): The attribute of the section to fetch.
Returns:
str: The string corresponding to the section and attri... | [
"Try",
"to",
"parse",
"an",
"attribute",
"of",
"the",
"config",
"file",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L150-L169 |
249,248 | slarse/pdfebc-core | pdfebc_core/config_utils.py | valid_config_exists | def valid_config_exists(config_path=CONFIG_PATH):
"""Verify that a valid config file exists.
Args:
config_path (str): Path to the config file.
Returns:
boolean: True if there is a valid config file, false if not.
"""
if os.path.isfile(config_path):
try:
config =... | python | def valid_config_exists(config_path=CONFIG_PATH):
"""Verify that a valid config file exists.
Args:
config_path (str): Path to the config file.
Returns:
boolean: True if there is a valid config file, false if not.
"""
if os.path.isfile(config_path):
try:
config =... | [
"def",
"valid_config_exists",
"(",
"config_path",
"=",
"CONFIG_PATH",
")",
":",
"if",
"os",
".",
"path",
".",
"isfile",
"(",
"config_path",
")",
":",
"try",
":",
"config",
"=",
"read_config",
"(",
"config_path",
")",
"check_config",
"(",
"config",
")",
"ex... | Verify that a valid config file exists.
Args:
config_path (str): Path to the config file.
Returns:
boolean: True if there is a valid config file, false if not. | [
"Verify",
"that",
"a",
"valid",
"config",
"file",
"exists",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L171-L188 |
249,249 | slarse/pdfebc-core | pdfebc_core/config_utils.py | config_to_string | def config_to_string(config):
"""Nice output string for the config, which is a nested defaultdict.
Args:
config (defaultdict(defaultdict)): The configuration information.
Returns:
str: A human-readable output string detailing the contents of the config.
"""
output = []
for secti... | python | def config_to_string(config):
"""Nice output string for the config, which is a nested defaultdict.
Args:
config (defaultdict(defaultdict)): The configuration information.
Returns:
str: A human-readable output string detailing the contents of the config.
"""
output = []
for secti... | [
"def",
"config_to_string",
"(",
"config",
")",
":",
"output",
"=",
"[",
"]",
"for",
"section",
",",
"section_content",
"in",
"config",
".",
"items",
"(",
")",
":",
"output",
".",
"append",
"(",
"\"[{}]\"",
".",
"format",
"(",
"section",
")",
")",
"for"... | Nice output string for the config, which is a nested defaultdict.
Args:
config (defaultdict(defaultdict)): The configuration information.
Returns:
str: A human-readable output string detailing the contents of the config. | [
"Nice",
"output",
"string",
"for",
"the",
"config",
"which",
"is",
"a",
"nested",
"defaultdict",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L190-L203 |
249,250 | slarse/pdfebc-core | pdfebc_core/config_utils.py | _config_parser_to_defaultdict | def _config_parser_to_defaultdict(config_parser):
"""Convert a ConfigParser to a defaultdict.
Args:
config_parser (ConfigParser): A ConfigParser.
"""
config = defaultdict(defaultdict)
for section, section_content in config_parser.items():
if section != 'DEFAULT':
for opt... | python | def _config_parser_to_defaultdict(config_parser):
"""Convert a ConfigParser to a defaultdict.
Args:
config_parser (ConfigParser): A ConfigParser.
"""
config = defaultdict(defaultdict)
for section, section_content in config_parser.items():
if section != 'DEFAULT':
for opt... | [
"def",
"_config_parser_to_defaultdict",
"(",
"config_parser",
")",
":",
"config",
"=",
"defaultdict",
"(",
"defaultdict",
")",
"for",
"section",
",",
"section_content",
"in",
"config_parser",
".",
"items",
"(",
")",
":",
"if",
"section",
"!=",
"'DEFAULT'",
":",
... | Convert a ConfigParser to a defaultdict.
Args:
config_parser (ConfigParser): A ConfigParser. | [
"Convert",
"a",
"ConfigParser",
"to",
"a",
"defaultdict",
"."
] | fc40857bc42365b7434714333e37d7a3487603a0 | https://github.com/slarse/pdfebc-core/blob/fc40857bc42365b7434714333e37d7a3487603a0/pdfebc_core/config_utils.py#L205-L216 |
249,251 | cfobel/ipython-helpers | ipython_helpers/notebook.py | Session.start | def start(self, *args, **kwargs):
'''
Launch IPython notebook server in background process.
Arguments and keyword arguments are passed on to `Popen` call.
By default, notebook server is launched using current working directory
as the notebook directory.
'''
if '... | python | def start(self, *args, **kwargs):
'''
Launch IPython notebook server in background process.
Arguments and keyword arguments are passed on to `Popen` call.
By default, notebook server is launched using current working directory
as the notebook directory.
'''
if '... | [
"def",
"start",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'stderr'",
"in",
"kwargs",
":",
"raise",
"ValueError",
"(",
"'`stderr` must not be specified, since it must be'",
"' monitored to determine which port the notebook '",
"'server is r... | Launch IPython notebook server in background process.
Arguments and keyword arguments are passed on to `Popen` call.
By default, notebook server is launched using current working directory
as the notebook directory. | [
"Launch",
"IPython",
"notebook",
"server",
"in",
"background",
"process",
"."
] | 8bc15ed68df96115b84202b5ca23a6ce048d5daf | https://github.com/cfobel/ipython-helpers/blob/8bc15ed68df96115b84202b5ca23a6ce048d5daf/ipython_helpers/notebook.py#L46-L86 |
249,252 | cfobel/ipython-helpers | ipython_helpers/notebook.py | Session.open | def open(self, filename=None):
'''
Open a browser tab with the notebook path specified relative to the
notebook directory.
If no filename is specified, open the root of the notebook server.
'''
if filename is None:
address = self.address + 'tree'
else... | python | def open(self, filename=None):
'''
Open a browser tab with the notebook path specified relative to the
notebook directory.
If no filename is specified, open the root of the notebook server.
'''
if filename is None:
address = self.address + 'tree'
else... | [
"def",
"open",
"(",
"self",
",",
"filename",
"=",
"None",
")",
":",
"if",
"filename",
"is",
"None",
":",
"address",
"=",
"self",
".",
"address",
"+",
"'tree'",
"else",
":",
"notebook_path",
"=",
"self",
".",
"resource_filename",
"(",
"filename",
")",
"... | Open a browser tab with the notebook path specified relative to the
notebook directory.
If no filename is specified, open the root of the notebook server. | [
"Open",
"a",
"browser",
"tab",
"with",
"the",
"notebook",
"path",
"specified",
"relative",
"to",
"the",
"notebook",
"directory",
"."
] | 8bc15ed68df96115b84202b5ca23a6ce048d5daf | https://github.com/cfobel/ipython-helpers/blob/8bc15ed68df96115b84202b5ca23a6ce048d5daf/ipython_helpers/notebook.py#L115-L130 |
249,253 | cfobel/ipython-helpers | ipython_helpers/notebook.py | SessionManager.get_session | def get_session(self, notebook_dir=None, no_browser=True, **kwargs):
'''
Return handle to IPython session for specified notebook directory.
If an IPython notebook session has already been launched for the
notebook directory, reuse it. Otherwise, launch a new IPython notebook
se... | python | def get_session(self, notebook_dir=None, no_browser=True, **kwargs):
'''
Return handle to IPython session for specified notebook directory.
If an IPython notebook session has already been launched for the
notebook directory, reuse it. Otherwise, launch a new IPython notebook
se... | [
"def",
"get_session",
"(",
"self",
",",
"notebook_dir",
"=",
"None",
",",
"no_browser",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"notebook_dir",
"in",
"self",
".",
"sessions",
"and",
"self",
".",
"sessions",
"[",
"notebook_dir",
"]",
".",
... | Return handle to IPython session for specified notebook directory.
If an IPython notebook session has already been launched for the
notebook directory, reuse it. Otherwise, launch a new IPython notebook
session.
By default, notebook session is launched using current working
di... | [
"Return",
"handle",
"to",
"IPython",
"session",
"for",
"specified",
"notebook",
"directory",
"."
] | 8bc15ed68df96115b84202b5ca23a6ce048d5daf | https://github.com/cfobel/ipython-helpers/blob/8bc15ed68df96115b84202b5ca23a6ce048d5daf/ipython_helpers/notebook.py#L223-L261 |
249,254 | jtpaasch/simplygithub | simplygithub/internals/blobs.py | get_blob | def get_blob(profile, sha):
"""Fetch a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
The SHA of th... | python | def get_blob(profile, sha):
"""Fetch a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
The SHA of th... | [
"def",
"get_blob",
"(",
"profile",
",",
"sha",
")",
":",
"resource",
"=",
"\"/blobs/\"",
"+",
"sha",
"data",
"=",
"api",
".",
"get_request",
"(",
"profile",
",",
"resource",
")",
"return",
"prepare",
"(",
"data",
")"
] | Fetch a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
sha
The SHA of the blob to fetch.
Returns:
... | [
"Fetch",
"a",
"blob",
"."
] | b77506275ec276ce90879bf1ea9299a79448b903 | https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/blobs.py#L16-L35 |
249,255 | jtpaasch/simplygithub | simplygithub/internals/blobs.py | create_blob | def create_blob(profile, content):
"""Create a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
content
T... | python | def create_blob(profile, content):
"""Create a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
content
T... | [
"def",
"create_blob",
"(",
"profile",
",",
"content",
")",
":",
"resource",
"=",
"\"/blobs\"",
"payload",
"=",
"{",
"\"content\"",
":",
"content",
"}",
"data",
"=",
"api",
".",
"post_request",
"(",
"profile",
",",
"resource",
",",
"payload",
")",
"return",... | Create a blob.
Args:
profile
A profile generated from ``simplygithub.authentication.profile``.
Such profiles tell this module (i) the ``repo`` to connect to,
and (ii) the ``token`` to connect with.
content
The (UTF-8 encoded) content to create in th... | [
"Create",
"a",
"blob",
"."
] | b77506275ec276ce90879bf1ea9299a79448b903 | https://github.com/jtpaasch/simplygithub/blob/b77506275ec276ce90879bf1ea9299a79448b903/simplygithub/internals/blobs.py#L38-L58 |
249,256 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.copy | def copy(self):
"""
Copy constructor for Sequence objects.
"""
return Sequence(self.name, self.sequenceData, self.start, self.end,
self.strand, self.remaining, self.meta_data,
self.mutableString) | python | def copy(self):
"""
Copy constructor for Sequence objects.
"""
return Sequence(self.name, self.sequenceData, self.start, self.end,
self.strand, self.remaining, self.meta_data,
self.mutableString) | [
"def",
"copy",
"(",
"self",
")",
":",
"return",
"Sequence",
"(",
"self",
".",
"name",
",",
"self",
".",
"sequenceData",
",",
"self",
".",
"start",
",",
"self",
".",
"end",
",",
"self",
".",
"strand",
",",
"self",
".",
"remaining",
",",
"self",
".",... | Copy constructor for Sequence objects. | [
"Copy",
"constructor",
"for",
"Sequence",
"objects",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L127-L133 |
249,257 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.effective_len | def effective_len(self):
"""
Get the length of the sequence if N's are disregarded.
"""
if self._effective_len is None:
self._effective_len = len([nuc for nuc in self.sequenceData
if nuc != "N" and nuc != "n"])
return self._effective_len | python | def effective_len(self):
"""
Get the length of the sequence if N's are disregarded.
"""
if self._effective_len is None:
self._effective_len = len([nuc for nuc in self.sequenceData
if nuc != "N" and nuc != "n"])
return self._effective_len | [
"def",
"effective_len",
"(",
"self",
")",
":",
"if",
"self",
".",
"_effective_len",
"is",
"None",
":",
"self",
".",
"_effective_len",
"=",
"len",
"(",
"[",
"nuc",
"for",
"nuc",
"in",
"self",
".",
"sequenceData",
"if",
"nuc",
"!=",
"\"N\"",
"and",
"nuc"... | Get the length of the sequence if N's are disregarded. | [
"Get",
"the",
"length",
"of",
"the",
"sequence",
"if",
"N",
"s",
"are",
"disregarded",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L174-L181 |
249,258 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.percentNuc | def percentNuc(self, nuc):
"""
return the percentage of the sequence which is equal to the passed nuc.
:param nuc: the nucleotide to compute percentage composition for. There
is no check to make sure this is a valid nucleotide.
:return: the percentage of the sequence that is <nu... | python | def percentNuc(self, nuc):
"""
return the percentage of the sequence which is equal to the passed nuc.
:param nuc: the nucleotide to compute percentage composition for. There
is no check to make sure this is a valid nucleotide.
:return: the percentage of the sequence that is <nu... | [
"def",
"percentNuc",
"(",
"self",
",",
"nuc",
")",
":",
"count",
"=",
"reduce",
"(",
"lambda",
"x",
",",
"y",
":",
"x",
"+",
"1",
"if",
"y",
"==",
"nuc",
"else",
"x",
",",
"self",
".",
"sequenceData",
",",
"0",
")",
"return",
"count",
"/",
"flo... | return the percentage of the sequence which is equal to the passed nuc.
:param nuc: the nucleotide to compute percentage composition for. There
is no check to make sure this is a valid nucleotide.
:return: the percentage of the sequence that is <nuc> | [
"return",
"the",
"percentage",
"of",
"the",
"sequence",
"which",
"is",
"equal",
"to",
"the",
"passed",
"nuc",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L292-L301 |
249,259 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.reverseComplement | def reverseComplement(self, isRNA=None):
"""
Reverse complement this sequence in-place.
:param isRNA: if True, treat this sequence as RNA. If False, treat it as
DNA. If None (default), inspect the sequence and make a
guess as to whether it is RNA or DNA.
"""
... | python | def reverseComplement(self, isRNA=None):
"""
Reverse complement this sequence in-place.
:param isRNA: if True, treat this sequence as RNA. If False, treat it as
DNA. If None (default), inspect the sequence and make a
guess as to whether it is RNA or DNA.
"""
... | [
"def",
"reverseComplement",
"(",
"self",
",",
"isRNA",
"=",
"None",
")",
":",
"isRNA_l",
"=",
"self",
".",
"isRNA",
"(",
")",
"if",
"isRNA",
"is",
"None",
"else",
"isRNA",
"tmp",
"=",
"\"\"",
"for",
"n",
"in",
"self",
".",
"sequenceData",
":",
"if",
... | Reverse complement this sequence in-place.
:param isRNA: if True, treat this sequence as RNA. If False, treat it as
DNA. If None (default), inspect the sequence and make a
guess as to whether it is RNA or DNA. | [
"Reverse",
"complement",
"this",
"sequence",
"in",
"-",
"place",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L323-L339 |
249,260 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.maskRegion | def maskRegion(self, region):
"""
Replace nucleotides in this sequence in the regions given by Ns
:param region: any object with .start and .end attributes. Co-ords are
zero based and inclusive of both end points. Any other
attributes (e.g. chrom.) are ignored.... | python | def maskRegion(self, region):
"""
Replace nucleotides in this sequence in the regions given by Ns
:param region: any object with .start and .end attributes. Co-ords are
zero based and inclusive of both end points. Any other
attributes (e.g. chrom.) are ignored.... | [
"def",
"maskRegion",
"(",
"self",
",",
"region",
")",
":",
"if",
"region",
".",
"start",
"<",
"0",
"or",
"region",
".",
"end",
"<",
"0",
"or",
"region",
".",
"start",
">",
"len",
"(",
"self",
")",
"or",
"region",
".",
"end",
">",
"len",
"(",
"s... | Replace nucleotides in this sequence in the regions given by Ns
:param region: any object with .start and .end attributes. Co-ords are
zero based and inclusive of both end points. Any other
attributes (e.g. chrom.) are ignored.
:raise SequenceError: if region speci... | [
"Replace",
"nucleotides",
"in",
"this",
"sequence",
"in",
"the",
"regions",
"given",
"by",
"Ns"
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L384-L408 |
249,261 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.maskRegions | def maskRegions(self, regions, verbose=False):
"""
Mask the given regions in this sequence with Ns.
:param region: iterable of regions to mask. Each region can be any object
with .start and .end attributes. Co-ords are zero based
and inclusive of both end point... | python | def maskRegions(self, regions, verbose=False):
"""
Mask the given regions in this sequence with Ns.
:param region: iterable of regions to mask. Each region can be any object
with .start and .end attributes. Co-ords are zero based
and inclusive of both end point... | [
"def",
"maskRegions",
"(",
"self",
",",
"regions",
",",
"verbose",
"=",
"False",
")",
":",
"if",
"verbose",
":",
"pind",
"=",
"ProgressIndicator",
"(",
"totalToDo",
"=",
"len",
"(",
"regions",
")",
",",
"messagePrefix",
"=",
"\"completed\"",
",",
"messageS... | Mask the given regions in this sequence with Ns.
:param region: iterable of regions to mask. Each region can be any object
with .start and .end attributes. Co-ords are zero based
and inclusive of both end points. Any other attributes
(e.g. chrom.) ar... | [
"Mask",
"the",
"given",
"regions",
"in",
"this",
"sequence",
"with",
"Ns",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L410-L429 |
249,262 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.split | def split(self, point=None):
"""
Split this sequence into two halves and return them. The original
sequence remains unmodified.
:param point: defines the split point, if None then the centre is used
:return: two Sequence objects -- one for each side
"""
if point is None:
point... | python | def split(self, point=None):
"""
Split this sequence into two halves and return them. The original
sequence remains unmodified.
:param point: defines the split point, if None then the centre is used
:return: two Sequence objects -- one for each side
"""
if point is None:
point... | [
"def",
"split",
"(",
"self",
",",
"point",
"=",
"None",
")",
":",
"if",
"point",
"is",
"None",
":",
"point",
"=",
"len",
"(",
"self",
")",
"/",
"2",
"r1",
"=",
"Sequence",
"(",
"self",
".",
"name",
"+",
"\".1\"",
",",
"self",
".",
"sequenceData",... | Split this sequence into two halves and return them. The original
sequence remains unmodified.
:param point: defines the split point, if None then the centre is used
:return: two Sequence objects -- one for each side | [
"Split",
"this",
"sequence",
"into",
"two",
"halves",
"and",
"return",
"them",
".",
"The",
"original",
"sequence",
"remains",
"unmodified",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L468-L482 |
249,263 | pjuren/pyokit | src/pyokit/datastruct/sequence.py | Sequence.maskMatch | def maskMatch(self, mask):
"""
Determine whether this sequence matches the given mask.
:param mask: string to match against. Ns in the mask are considered to
match anything in the sequence -- all other chars must
match exactly.
:return: True if the mask match... | python | def maskMatch(self, mask):
"""
Determine whether this sequence matches the given mask.
:param mask: string to match against. Ns in the mask are considered to
match anything in the sequence -- all other chars must
match exactly.
:return: True if the mask match... | [
"def",
"maskMatch",
"(",
"self",
",",
"mask",
")",
":",
"if",
"len",
"(",
"mask",
")",
">",
"len",
"(",
"self",
".",
"sequenceData",
")",
":",
"return",
"False",
"lim",
"=",
"len",
"(",
"mask",
")",
"for",
"i",
"in",
"range",
"(",
"0",
",",
"li... | Determine whether this sequence matches the given mask.
:param mask: string to match against. Ns in the mask are considered to
match anything in the sequence -- all other chars must
match exactly.
:return: True if the mask matches at all places, otherwise false | [
"Determine",
"whether",
"this",
"sequence",
"matches",
"the",
"given",
"mask",
"."
] | fddae123b5d817daa39496183f19c000d9c3791f | https://github.com/pjuren/pyokit/blob/fddae123b5d817daa39496183f19c000d9c3791f/src/pyokit/datastruct/sequence.py#L548-L565 |
249,264 | nws-cip/zenconf | zenconf/merged_config.py | walk_recursive | def walk_recursive(f, data):
"""
Recursively apply a function to all dicts in a nested dictionary
:param f: Function to apply
:param data: Dictionary (possibly nested) to recursively apply
function to
:return:
"""
results = {}
if isinstance(data, list):
return [walk_recursiv... | python | def walk_recursive(f, data):
"""
Recursively apply a function to all dicts in a nested dictionary
:param f: Function to apply
:param data: Dictionary (possibly nested) to recursively apply
function to
:return:
"""
results = {}
if isinstance(data, list):
return [walk_recursiv... | [
"def",
"walk_recursive",
"(",
"f",
",",
"data",
")",
":",
"results",
"=",
"{",
"}",
"if",
"isinstance",
"(",
"data",
",",
"list",
")",
":",
"return",
"[",
"walk_recursive",
"(",
"f",
",",
"d",
")",
"for",
"d",
"in",
"data",
"]",
"elif",
"isinstance... | Recursively apply a function to all dicts in a nested dictionary
:param f: Function to apply
:param data: Dictionary (possibly nested) to recursively apply
function to
:return: | [
"Recursively",
"apply",
"a",
"function",
"to",
"all",
"dicts",
"in",
"a",
"nested",
"dictionary"
] | fc96706468c0741fb1b54b2eeb9f9225737e3e36 | https://github.com/nws-cip/zenconf/blob/fc96706468c0741fb1b54b2eeb9f9225737e3e36/zenconf/merged_config.py#L47-L70 |
249,265 | nws-cip/zenconf | zenconf/merged_config.py | MergedConfig.add | def add(self, config, strip_app_name=False, filter_by_app_name=False,
key_normalisation_func=default_key_normalisation_func):
"""
Add a dict of config data. Values from later dicts will take precedence
over those added earlier, so the order data is added matters.
Note: Doubl... | python | def add(self, config, strip_app_name=False, filter_by_app_name=False,
key_normalisation_func=default_key_normalisation_func):
"""
Add a dict of config data. Values from later dicts will take precedence
over those added earlier, so the order data is added matters.
Note: Doubl... | [
"def",
"add",
"(",
"self",
",",
"config",
",",
"strip_app_name",
"=",
"False",
",",
"filter_by_app_name",
"=",
"False",
",",
"key_normalisation_func",
"=",
"default_key_normalisation_func",
")",
":",
"config",
"=",
"walk_recursive",
"(",
"key_normalisation_func",
",... | Add a dict of config data. Values from later dicts will take precedence
over those added earlier, so the order data is added matters.
Note: Double underscores can be used to indicate dict key name
boundaries. i.e. if we have a dict like:
{
'logging': {
'leve... | [
"Add",
"a",
"dict",
"of",
"config",
"data",
".",
"Values",
"from",
"later",
"dicts",
"will",
"take",
"precedence",
"over",
"those",
"added",
"earlier",
"so",
"the",
"order",
"data",
"is",
"added",
"matters",
"."
] | fc96706468c0741fb1b54b2eeb9f9225737e3e36 | https://github.com/nws-cip/zenconf/blob/fc96706468c0741fb1b54b2eeb9f9225737e3e36/zenconf/merged_config.py#L160-L209 |
249,266 | flo-compbio/gopca-server | gpserver/config.py | GSConfig.set_param | def set_param(self, name, value):
"""Set a GO-PCA Server parameter.
Parameters
----------
name: str
The parameter name.
value: ?
The parameter value.
"""
if name not in self.param_names:
raise ValueError('No GO-PCA Server param... | python | def set_param(self, name, value):
"""Set a GO-PCA Server parameter.
Parameters
----------
name: str
The parameter name.
value: ?
The parameter value.
"""
if name not in self.param_names:
raise ValueError('No GO-PCA Server param... | [
"def",
"set_param",
"(",
"self",
",",
"name",
",",
"value",
")",
":",
"if",
"name",
"not",
"in",
"self",
".",
"param_names",
":",
"raise",
"ValueError",
"(",
"'No GO-PCA Server parameter named \"%s\"!'",
"%",
"(",
"param",
")",
")",
"self",
".",
"__params",
... | Set a GO-PCA Server parameter.
Parameters
----------
name: str
The parameter name.
value: ?
The parameter value. | [
"Set",
"a",
"GO",
"-",
"PCA",
"Server",
"parameter",
"."
] | 4fe396b12c39c0f156ce3bc4538cade54c9d7ffe | https://github.com/flo-compbio/gopca-server/blob/4fe396b12c39c0f156ce3bc4538cade54c9d7ffe/gpserver/config.py#L147-L159 |
249,267 | flo-compbio/gopca-server | gpserver/config.py | GSConfig.set_params | def set_params(self, params):
"""Sets multiple GO-PCA Server parameters using a dictionary.
Parameters
----------
params: dict
Dictionary containing the parameter values.
Returns
-------
None
"""
for k,v in params.iteritems():
... | python | def set_params(self, params):
"""Sets multiple GO-PCA Server parameters using a dictionary.
Parameters
----------
params: dict
Dictionary containing the parameter values.
Returns
-------
None
"""
for k,v in params.iteritems():
... | [
"def",
"set_params",
"(",
"self",
",",
"params",
")",
":",
"for",
"k",
",",
"v",
"in",
"params",
".",
"iteritems",
"(",
")",
":",
"self",
".",
"set_param",
"(",
"k",
",",
"v",
")"
] | Sets multiple GO-PCA Server parameters using a dictionary.
Parameters
----------
params: dict
Dictionary containing the parameter values.
Returns
-------
None | [
"Sets",
"multiple",
"GO",
"-",
"PCA",
"Server",
"parameters",
"using",
"a",
"dictionary",
"."
] | 4fe396b12c39c0f156ce3bc4538cade54c9d7ffe | https://github.com/flo-compbio/gopca-server/blob/4fe396b12c39c0f156ce3bc4538cade54c9d7ffe/gpserver/config.py#L161-L174 |
249,268 | flo-compbio/gopca-server | gpserver/config.py | GSConfig.reset_params | def reset_params(self):
"""Reset all parameters to their default values."""
self.__params = dict([p, None] for p in self.param_names)
self.set_params(self.param_defaults) | python | def reset_params(self):
"""Reset all parameters to their default values."""
self.__params = dict([p, None] for p in self.param_names)
self.set_params(self.param_defaults) | [
"def",
"reset_params",
"(",
"self",
")",
":",
"self",
".",
"__params",
"=",
"dict",
"(",
"[",
"p",
",",
"None",
"]",
"for",
"p",
"in",
"self",
".",
"param_names",
")",
"self",
".",
"set_params",
"(",
"self",
".",
"param_defaults",
")"
] | Reset all parameters to their default values. | [
"Reset",
"all",
"parameters",
"to",
"their",
"default",
"values",
"."
] | 4fe396b12c39c0f156ce3bc4538cade54c9d7ffe | https://github.com/flo-compbio/gopca-server/blob/4fe396b12c39c0f156ce3bc4538cade54c9d7ffe/gpserver/config.py#L176-L179 |
249,269 | rocktavious/waybill | waybill/cli.py | waybill.create | def create(cli, command, docker_id):
"""Creates waybill shims from a given command name and docker image"""
content = waybill_template.format(command=command,
docker_id=docker_id)
waybill_dir = cli.get_waybill_dir()
waybill_filename = os.path.joi... | python | def create(cli, command, docker_id):
"""Creates waybill shims from a given command name and docker image"""
content = waybill_template.format(command=command,
docker_id=docker_id)
waybill_dir = cli.get_waybill_dir()
waybill_filename = os.path.joi... | [
"def",
"create",
"(",
"cli",
",",
"command",
",",
"docker_id",
")",
":",
"content",
"=",
"waybill_template",
".",
"format",
"(",
"command",
"=",
"command",
",",
"docker_id",
"=",
"docker_id",
")",
"waybill_dir",
"=",
"cli",
".",
"get_waybill_dir",
"(",
")"... | Creates waybill shims from a given command name and docker image | [
"Creates",
"waybill",
"shims",
"from",
"a",
"given",
"command",
"name",
"and",
"docker",
"image"
] | 62630f3ab67d6f253f09fbcde6fa7386acf9c2e8 | https://github.com/rocktavious/waybill/blob/62630f3ab67d6f253f09fbcde6fa7386acf9c2e8/waybill/cli.py#L57-L65 |
249,270 | rocktavious/waybill | waybill/cli.py | waybill.load | def load(cli, yaml_filename):
"""Creates waybill shims from a given yaml file definiations"""
"""Expected Definition:
- name: NAME
docker_id: IMAGE
- name: NAME
docker_id: IMAGE
"""
with open(yaml_filename, 'rb') as filehandle:
for waybill ... | python | def load(cli, yaml_filename):
"""Creates waybill shims from a given yaml file definiations"""
"""Expected Definition:
- name: NAME
docker_id: IMAGE
- name: NAME
docker_id: IMAGE
"""
with open(yaml_filename, 'rb') as filehandle:
for waybill ... | [
"def",
"load",
"(",
"cli",
",",
"yaml_filename",
")",
":",
"\"\"\"Expected Definition:\n - name: NAME\n docker_id: IMAGE\n - name: NAME\n docker_id: IMAGE\n \"\"\"",
"with",
"open",
"(",
"yaml_filename",
",",
"'rb'",
")",
"as",
"filehandle",
... | Creates waybill shims from a given yaml file definiations | [
"Creates",
"waybill",
"shims",
"from",
"a",
"given",
"yaml",
"file",
"definiations"
] | 62630f3ab67d6f253f09fbcde6fa7386acf9c2e8 | https://github.com/rocktavious/waybill/blob/62630f3ab67d6f253f09fbcde6fa7386acf9c2e8/waybill/cli.py#L68-L79 |
249,271 | rocktavious/waybill | waybill/cli.py | waybill.shellinit | def shellinit(cli):
"""Implements the waybill shims in the active shell"""
output = 'eval echo "Initializing Waybills"'
if which('docker') is None:
raise ValueError("Unable to find program 'docker'. Please make sure it is installed and setup properly")
for waybill in cli.get... | python | def shellinit(cli):
"""Implements the waybill shims in the active shell"""
output = 'eval echo "Initializing Waybills"'
if which('docker') is None:
raise ValueError("Unable to find program 'docker'. Please make sure it is installed and setup properly")
for waybill in cli.get... | [
"def",
"shellinit",
"(",
"cli",
")",
":",
"output",
"=",
"'eval echo \"Initializing Waybills\"'",
"if",
"which",
"(",
"'docker'",
")",
"is",
"None",
":",
"raise",
"ValueError",
"(",
"\"Unable to find program 'docker'. Please make sure it is installed and setup properly\"",
... | Implements the waybill shims in the active shell | [
"Implements",
"the",
"waybill",
"shims",
"in",
"the",
"active",
"shell"
] | 62630f3ab67d6f253f09fbcde6fa7386acf9c2e8 | https://github.com/rocktavious/waybill/blob/62630f3ab67d6f253f09fbcde6fa7386acf9c2e8/waybill/cli.py#L94-L101 |
249,272 | henrysher/kotocore | kotocore/connection.py | ConnectionDetails.service_data | def service_data(self):
"""
Returns all introspected service data.
If the data has been previously accessed, a memoized version of the
data is returned.
:returns: A dict of introspected service data
:rtype: dict
"""
# Lean on the cache first.
if ... | python | def service_data(self):
"""
Returns all introspected service data.
If the data has been previously accessed, a memoized version of the
data is returned.
:returns: A dict of introspected service data
:rtype: dict
"""
# Lean on the cache first.
if ... | [
"def",
"service_data",
"(",
"self",
")",
":",
"# Lean on the cache first.",
"if",
"self",
".",
"_loaded_service_data",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_loaded_service_data",
"# We don't have a cache. Build it.",
"self",
".",
"_loaded_service_data",
"="... | Returns all introspected service data.
If the data has been previously accessed, a memoized version of the
data is returned.
:returns: A dict of introspected service data
:rtype: dict | [
"Returns",
"all",
"introspected",
"service",
"data",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/connection.py#L42-L65 |
249,273 | henrysher/kotocore | kotocore/connection.py | ConnectionDetails.api_version | def api_version(self):
"""
Returns API version introspected from the service data.
If the data has been previously accessed, a memoized version of the
API version is returned.
:returns: The service's version
:rtype: string
"""
# Lean on the cache first.
... | python | def api_version(self):
"""
Returns API version introspected from the service data.
If the data has been previously accessed, a memoized version of the
API version is returned.
:returns: The service's version
:rtype: string
"""
# Lean on the cache first.
... | [
"def",
"api_version",
"(",
"self",
")",
":",
"# Lean on the cache first.",
"if",
"self",
".",
"_api_version",
"is",
"not",
"None",
":",
"return",
"self",
".",
"_api_version",
"# We don't have a cache. Build it.",
"self",
".",
"_api_version",
"=",
"self",
".",
"_in... | Returns API version introspected from the service data.
If the data has been previously accessed, a memoized version of the
API version is returned.
:returns: The service's version
:rtype: string | [
"Returns",
"API",
"version",
"introspected",
"from",
"the",
"service",
"data",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/connection.py#L68-L87 |
249,274 | henrysher/kotocore | kotocore/connection.py | ConnectionFactory.construct_for | def construct_for(self, service_name):
"""
Builds a new, specialized ``Connection`` subclass for a given service.
This will introspect a service, determine all the API calls it has &
constructs a brand new class with those methods on it.
:param service_name: The name of the ser... | python | def construct_for(self, service_name):
"""
Builds a new, specialized ``Connection`` subclass for a given service.
This will introspect a service, determine all the API calls it has &
constructs a brand new class with those methods on it.
:param service_name: The name of the ser... | [
"def",
"construct_for",
"(",
"self",
",",
"service_name",
")",
":",
"# Construct a new ``ConnectionDetails`` (or similar class) for storing",
"# the relevant details about the service & its operations.",
"details",
"=",
"self",
".",
"details_class",
"(",
"service_name",
",",
"sel... | Builds a new, specialized ``Connection`` subclass for a given service.
This will introspect a service, determine all the API calls it has &
constructs a brand new class with those methods on it.
:param service_name: The name of the service to construct a connection
for. Ex. ``sqs``... | [
"Builds",
"a",
"new",
"specialized",
"Connection",
"subclass",
"for",
"a",
"given",
"service",
"."
] | c52d2f3878b924ceabca07f61c91abcb1b230ecc | https://github.com/henrysher/kotocore/blob/c52d2f3878b924ceabca07f61c91abcb1b230ecc/kotocore/connection.py#L258-L291 |
249,275 | sochotnicky/pytrailer | pytrailer.py | getMoviesFromJSON | def getMoviesFromJSON(jsonURL):
"""Main function for this library
Returns list of Movie classes from apple.com/trailers json URL
such as: http://trailers.apple.com/trailers/home/feeds/just_added.json
The Movie classes use lazy loading mechanisms so that data not
directly available from JSON are lo... | python | def getMoviesFromJSON(jsonURL):
"""Main function for this library
Returns list of Movie classes from apple.com/trailers json URL
such as: http://trailers.apple.com/trailers/home/feeds/just_added.json
The Movie classes use lazy loading mechanisms so that data not
directly available from JSON are lo... | [
"def",
"getMoviesFromJSON",
"(",
"jsonURL",
")",
":",
"response",
"=",
"urllib",
".",
"request",
".",
"urlopen",
"(",
"jsonURL",
")",
"jsonData",
"=",
"response",
".",
"read",
"(",
")",
".",
"decode",
"(",
"'utf-8'",
")",
"objects",
"=",
"json",
".",
"... | Main function for this library
Returns list of Movie classes from apple.com/trailers json URL
such as: http://trailers.apple.com/trailers/home/feeds/just_added.json
The Movie classes use lazy loading mechanisms so that data not
directly available from JSON are loaded on demand. Currently these
laz... | [
"Main",
"function",
"for",
"this",
"library"
] | f5ebcb14a53c32b7545a334191745e208a3cc319 | https://github.com/sochotnicky/pytrailer/blob/f5ebcb14a53c32b7545a334191745e208a3cc319/pytrailer.py#L20-L72 |
249,276 | sochotnicky/pytrailer | pytrailer.py | Movie.get_description | def get_description(self):
"""Returns description text as provided by the studio"""
if self._description:
return self._description
try:
trailerURL= "http://trailers.apple.com%s" % self.baseURL
response = urllib.request.urlopen(trailerURL)
Reader =... | python | def get_description(self):
"""Returns description text as provided by the studio"""
if self._description:
return self._description
try:
trailerURL= "http://trailers.apple.com%s" % self.baseURL
response = urllib.request.urlopen(trailerURL)
Reader =... | [
"def",
"get_description",
"(",
"self",
")",
":",
"if",
"self",
".",
"_description",
":",
"return",
"self",
".",
"_description",
"try",
":",
"trailerURL",
"=",
"\"http://trailers.apple.com%s\"",
"%",
"self",
".",
"baseURL",
"response",
"=",
"urllib",
".",
"requ... | Returns description text as provided by the studio | [
"Returns",
"description",
"text",
"as",
"provided",
"by",
"the",
"studio"
] | f5ebcb14a53c32b7545a334191745e208a3cc319 | https://github.com/sochotnicky/pytrailer/blob/f5ebcb14a53c32b7545a334191745e208a3cc319/pytrailer.py#L130-L149 |
249,277 | eddiejessup/metropack | metropack/draw.py | _unwrap_one_layer | def _unwrap_one_layer(r, L, n):
"""For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points at a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: integer.... | python | def _unwrap_one_layer(r, L, n):
"""For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points at a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: integer.... | [
"def",
"_unwrap_one_layer",
"(",
"r",
",",
"L",
",",
"n",
")",
":",
"try",
":",
"L",
"[",
"0",
"]",
"except",
"(",
"TypeError",
",",
"IndexError",
")",
":",
"L",
"=",
"np",
".",
"ones",
"(",
"[",
"r",
".",
"shape",
"[",
"1",
"]",
"]",
")",
... | For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points at a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: integer.
Period to unwrap.
Returns... | [
"For",
"a",
"set",
"of",
"points",
"in",
"a",
"2",
"dimensional",
"periodic",
"system",
"extend",
"the",
"set",
"of",
"points",
"to",
"tile",
"the",
"points",
"at",
"a",
"given",
"period",
"."
] | 528b47d0f2f70f39e1490e41433f2da8c8b9d63c | https://github.com/eddiejessup/metropack/blob/528b47d0f2f70f39e1490e41433f2da8c8b9d63c/metropack/draw.py#L6-L37 |
249,278 | eddiejessup/metropack | metropack/draw.py | _unwrap_to_layer | def _unwrap_to_layer(r, L, n=1):
"""For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points up to to a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: i... | python | def _unwrap_to_layer(r, L, n=1):
"""For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points up to to a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: i... | [
"def",
"_unwrap_to_layer",
"(",
"r",
",",
"L",
",",
"n",
"=",
"1",
")",
":",
"rcu",
"=",
"[",
"]",
"for",
"i_n",
"in",
"range",
"(",
"n",
"+",
"1",
")",
":",
"rcu",
".",
"extend",
"(",
"_unwrap_one_layer",
"(",
"r",
",",
"L",
",",
"i_n",
")",... | For a set of points in a 2 dimensional periodic system, extend the set of
points to tile the points up to to a given period.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
L: float array, shape (2,)
System lengths.
n: integer.
Period to unwrap up to.
... | [
"For",
"a",
"set",
"of",
"points",
"in",
"a",
"2",
"dimensional",
"periodic",
"system",
"extend",
"the",
"set",
"of",
"points",
"to",
"tile",
"the",
"points",
"up",
"to",
"to",
"a",
"given",
"period",
"."
] | 528b47d0f2f70f39e1490e41433f2da8c8b9d63c | https://github.com/eddiejessup/metropack/blob/528b47d0f2f70f39e1490e41433f2da8c8b9d63c/metropack/draw.py#L40-L62 |
249,279 | eddiejessup/metropack | metropack/draw.py | draw_medium | def draw_medium(r, R, L, n=1, ax=None):
"""Draw circles representing circles in a two-dimensional periodic system.
Circles may be tiled up to a number of periods.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
R: float
Circle radius.
L: float array, shape... | python | def draw_medium(r, R, L, n=1, ax=None):
"""Draw circles representing circles in a two-dimensional periodic system.
Circles may be tiled up to a number of periods.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
R: float
Circle radius.
L: float array, shape... | [
"def",
"draw_medium",
"(",
"r",
",",
"R",
",",
"L",
",",
"n",
"=",
"1",
",",
"ax",
"=",
"None",
")",
":",
"if",
"ax",
"is",
"None",
":",
"ax",
"=",
"plt",
".",
"gca",
"(",
")",
"for",
"ru",
"in",
"_unwrap_to_layer",
"(",
"r",
",",
"L",
",",... | Draw circles representing circles in a two-dimensional periodic system.
Circles may be tiled up to a number of periods.
Parameters
----------
r: float array, shape (:, 2).
Set of points.
R: float
Circle radius.
L: float array, shape (2,)
System lengths.
n: integer.
... | [
"Draw",
"circles",
"representing",
"circles",
"in",
"a",
"two",
"-",
"dimensional",
"periodic",
"system",
".",
"Circles",
"may",
"be",
"tiled",
"up",
"to",
"a",
"number",
"of",
"periods",
"."
] | 528b47d0f2f70f39e1490e41433f2da8c8b9d63c | https://github.com/eddiejessup/metropack/blob/528b47d0f2f70f39e1490e41433f2da8c8b9d63c/metropack/draw.py#L65-L90 |
249,280 | DoWhileGeek/authentise-services | authentise_services/model.py | Model.upload | def upload(self, # pylint: disable=too-many-arguments
path,
name=None,
resize=False,
rotation=False,
callback_url=None,
callback_method=None,
auto_align=False, ):
"""Create a new model resource in the wareh... | python | def upload(self, # pylint: disable=too-many-arguments
path,
name=None,
resize=False,
rotation=False,
callback_url=None,
callback_method=None,
auto_align=False, ):
"""Create a new model resource in the wareh... | [
"def",
"upload",
"(",
"self",
",",
"# pylint: disable=too-many-arguments",
"path",
",",
"name",
"=",
"None",
",",
"resize",
"=",
"False",
",",
"rotation",
"=",
"False",
",",
"callback_url",
"=",
"None",
",",
"callback_method",
"=",
"None",
",",
"auto_align",
... | Create a new model resource in the warehouse and uploads the path contents to it | [
"Create",
"a",
"new",
"model",
"resource",
"in",
"the",
"warehouse",
"and",
"uploads",
"the",
"path",
"contents",
"to",
"it"
] | ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d | https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/model.py#L34-L70 |
249,281 | DoWhileGeek/authentise-services | authentise_services/model.py | Model.download | def download(self, path):
"""downloads a model resource to the path"""
service_get_resp = requests.get(self.location, cookies={"session": self.session})
payload = service_get_resp.json()
self._state = payload["status"]
if self._state != "processed":
raise errors.Reso... | python | def download(self, path):
"""downloads a model resource to the path"""
service_get_resp = requests.get(self.location, cookies={"session": self.session})
payload = service_get_resp.json()
self._state = payload["status"]
if self._state != "processed":
raise errors.Reso... | [
"def",
"download",
"(",
"self",
",",
"path",
")",
":",
"service_get_resp",
"=",
"requests",
".",
"get",
"(",
"self",
".",
"location",
",",
"cookies",
"=",
"{",
"\"session\"",
":",
"self",
".",
"session",
"}",
")",
"payload",
"=",
"service_get_resp",
".",... | downloads a model resource to the path | [
"downloads",
"a",
"model",
"resource",
"to",
"the",
"path"
] | ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d | https://github.com/DoWhileGeek/authentise-services/blob/ee32bd7f7de15d3fb24c0a6374640d3a1ec8096d/authentise_services/model.py#L72-L83 |
249,282 | heikomuller/sco-datastore | scodata/modelrun.py | ModelRunState.to_dict | def to_dict(obj):
"""Generate a JSON serialization for the run state object.
Returns
-------
Json-like object
Json serialization of model run state object
"""
# Have text description of state in Json object (for readability)
json_obj = {'type' : repr(... | python | def to_dict(obj):
"""Generate a JSON serialization for the run state object.
Returns
-------
Json-like object
Json serialization of model run state object
"""
# Have text description of state in Json object (for readability)
json_obj = {'type' : repr(... | [
"def",
"to_dict",
"(",
"obj",
")",
":",
"# Have text description of state in Json object (for readability)",
"json_obj",
"=",
"{",
"'type'",
":",
"repr",
"(",
"obj",
")",
"}",
"# Add state-specific elementsTYPE_MODEL_RUN",
"if",
"obj",
".",
"is_failed",
":",
"json_obj",... | Generate a JSON serialization for the run state object.
Returns
-------
Json-like object
Json serialization of model run state object | [
"Generate",
"a",
"JSON",
"serialization",
"for",
"the",
"run",
"state",
"object",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L131-L146 |
249,283 | heikomuller/sco-datastore | scodata/modelrun.py | DefaultModelRunManager.create_object | def create_object(self, name, experiment_id, model_id, argument_defs, arguments=None, properties=None):
"""Create a model run object with the given list of arguments. The
initial state of the object is RUNNING.
Raises ValueError if given arguments are invalid.
Parameters
------... | python | def create_object(self, name, experiment_id, model_id, argument_defs, arguments=None, properties=None):
"""Create a model run object with the given list of arguments. The
initial state of the object is RUNNING.
Raises ValueError if given arguments are invalid.
Parameters
------... | [
"def",
"create_object",
"(",
"self",
",",
"name",
",",
"experiment_id",
",",
"model_id",
",",
"argument_defs",
",",
"arguments",
"=",
"None",
",",
"properties",
"=",
"None",
")",
":",
"# Create a new object identifier.",
"identifier",
"=",
"str",
"(",
"uuid",
... | Create a model run object with the given list of arguments. The
initial state of the object is RUNNING.
Raises ValueError if given arguments are invalid.
Parameters
----------
name : string
User-provided name for the model run
experiment_id : string
... | [
"Create",
"a",
"model",
"run",
"object",
"with",
"the",
"given",
"list",
"of",
"arguments",
".",
"The",
"initial",
"state",
"of",
"the",
"object",
"is",
"RUNNING",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L456-L522 |
249,284 | heikomuller/sco-datastore | scodata/modelrun.py | DefaultModelRunManager.from_dict | def from_dict(self, document):
"""Create model run object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
PredictionHandle
Handle for model run object
"""... | python | def from_dict(self, document):
"""Create model run object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
PredictionHandle
Handle for model run object
"""... | [
"def",
"from_dict",
"(",
"self",
",",
"document",
")",
":",
"# Get object identifier from Json document",
"identifier",
"=",
"str",
"(",
"document",
"[",
"'_id'",
"]",
")",
"# Directories are simply named by object identifier",
"directory",
"=",
"os",
".",
"path",
"."... | Create model run object from JSON document retrieved from database.
Parameters
----------
document : JSON
Json document in database
Returns
-------
PredictionHandle
Handle for model run object | [
"Create",
"model",
"run",
"object",
"from",
"JSON",
"document",
"retrieved",
"from",
"database",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L557-L594 |
249,285 | heikomuller/sco-datastore | scodata/modelrun.py | DefaultModelRunManager.get_data_file_attachment | def get_data_file_attachment(self, identifier, resource_id):
"""Get path to attached data file with given resource identifer. If no
data file with given id exists the result will be None.
Raise ValueError if an image archive with the given resource identifier
is attached to the model ru... | python | def get_data_file_attachment(self, identifier, resource_id):
"""Get path to attached data file with given resource identifer. If no
data file with given id exists the result will be None.
Raise ValueError if an image archive with the given resource identifier
is attached to the model ru... | [
"def",
"get_data_file_attachment",
"(",
"self",
",",
"identifier",
",",
"resource_id",
")",
":",
"# Get model run to ensure that it exists. If not return None",
"model_run",
"=",
"self",
".",
"get_object",
"(",
"identifier",
")",
"if",
"model_run",
"is",
"None",
":",
... | Get path to attached data file with given resource identifer. If no
data file with given id exists the result will be None.
Raise ValueError if an image archive with the given resource identifier
is attached to the model run instead of a data file.
Parameters
----------
... | [
"Get",
"path",
"to",
"attached",
"data",
"file",
"with",
"given",
"resource",
"identifer",
".",
"If",
"no",
"data",
"file",
"with",
"given",
"id",
"exists",
"the",
"result",
"will",
"be",
"None",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L596-L625 |
249,286 | heikomuller/sco-datastore | scodata/modelrun.py | DefaultModelRunManager.to_dict | def to_dict(self, model_run):
"""Create a Json-like dictionary for a model run object. Extends the
basic object with run state, arguments, and optional prediction results
or error descriptions.
Parameters
----------
model_run : PredictionHandle
Returns
-... | python | def to_dict(self, model_run):
"""Create a Json-like dictionary for a model run object. Extends the
basic object with run state, arguments, and optional prediction results
or error descriptions.
Parameters
----------
model_run : PredictionHandle
Returns
-... | [
"def",
"to_dict",
"(",
"self",
",",
"model_run",
")",
":",
"# Get the basic Json object from the super class",
"json_obj",
"=",
"super",
"(",
"DefaultModelRunManager",
",",
"self",
")",
".",
"to_dict",
"(",
"model_run",
")",
"# Add run state",
"json_obj",
"[",
"'sta... | Create a Json-like dictionary for a model run object. Extends the
basic object with run state, arguments, and optional prediction results
or error descriptions.
Parameters
----------
model_run : PredictionHandle
Returns
-------
(JSON)
Json-li... | [
"Create",
"a",
"Json",
"-",
"like",
"dictionary",
"for",
"a",
"model",
"run",
"object",
".",
"Extends",
"the",
"basic",
"object",
"with",
"run",
"state",
"arguments",
"and",
"optional",
"prediction",
"results",
"or",
"error",
"descriptions",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L627-L658 |
249,287 | heikomuller/sco-datastore | scodata/modelrun.py | DefaultModelRunManager.update_state | def update_state(self, identifier, state):
"""Update state of identified model run.
Raises exception if state change results in invalid run life cycle.
Parameters
----------
identifier : string
Unique model run identifier
state : ModelRunState
Ob... | python | def update_state(self, identifier, state):
"""Update state of identified model run.
Raises exception if state change results in invalid run life cycle.
Parameters
----------
identifier : string
Unique model run identifier
state : ModelRunState
Ob... | [
"def",
"update_state",
"(",
"self",
",",
"identifier",
",",
"state",
")",
":",
"# Get model run to ensure that it exists",
"model_run",
"=",
"self",
".",
"get_object",
"(",
"identifier",
")",
"if",
"model_run",
"is",
"None",
":",
"return",
"None",
"# Set timestamp... | Update state of identified model run.
Raises exception if state change results in invalid run life cycle.
Parameters
----------
identifier : string
Unique model run identifier
state : ModelRunState
Object representing new run state
Returns
... | [
"Update",
"state",
"of",
"identified",
"model",
"run",
"."
] | 7180a6b51150667e47629da566aedaa742e39342 | https://github.com/heikomuller/sco-datastore/blob/7180a6b51150667e47629da566aedaa742e39342/scodata/modelrun.py#L660-L707 |
249,288 | OpenVolunteeringPlatform/django-ovp-projects | ovp_projects/views/project.py | ProjectResourceViewSet.partial_update | def partial_update(self, request, *args, **kwargs):
""" We do not include the mixin as we want only PATCH and no PUT """
instance = self.get_object()
serializer = self.get_serializer(instance, data=request.data, partial=True, context=self.get_serializer_context())
serializer.is_valid(raise_exception=Tru... | python | def partial_update(self, request, *args, **kwargs):
""" We do not include the mixin as we want only PATCH and no PUT """
instance = self.get_object()
serializer = self.get_serializer(instance, data=request.data, partial=True, context=self.get_serializer_context())
serializer.is_valid(raise_exception=Tru... | [
"def",
"partial_update",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"instance",
"=",
"self",
".",
"get_object",
"(",
")",
"serializer",
"=",
"self",
".",
"get_serializer",
"(",
"instance",
",",
"data",
"=",
"reque... | We do not include the mixin as we want only PATCH and no PUT | [
"We",
"do",
"not",
"include",
"the",
"mixin",
"as",
"we",
"want",
"only",
"PATCH",
"and",
"no",
"PUT"
] | 239e27027ca99c7b44ee4f30bf55d06439d49251 | https://github.com/OpenVolunteeringPlatform/django-ovp-projects/blob/239e27027ca99c7b44ee4f30bf55d06439d49251/ovp_projects/views/project.py#L46-L57 |
249,289 | cirruscluster/cirruscluster | cirruscluster/ext/ansible/runner/connection_plugins/ssh.py | Connection.connect | def connect(self):
''' connect to the remote host '''
vvv("ESTABLISH CONNECTION FOR USER: %s" % self.runner.remote_user, host=self.host)
self.common_args = []
extra_args = C.ANSIBLE_SSH_ARGS
if extra_args is not None:
self.common_args += shlex.split(extra_args)
... | python | def connect(self):
''' connect to the remote host '''
vvv("ESTABLISH CONNECTION FOR USER: %s" % self.runner.remote_user, host=self.host)
self.common_args = []
extra_args = C.ANSIBLE_SSH_ARGS
if extra_args is not None:
self.common_args += shlex.split(extra_args)
... | [
"def",
"connect",
"(",
"self",
")",
":",
"vvv",
"(",
"\"ESTABLISH CONNECTION FOR USER: %s\"",
"%",
"self",
".",
"runner",
".",
"remote_user",
",",
"host",
"=",
"self",
".",
"host",
")",
"self",
".",
"common_args",
"=",
"[",
"]",
"extra_args",
"=",
"C",
"... | connect to the remote host | [
"connect",
"to",
"the",
"remote",
"host"
] | 977409929dd81322d886425cdced10608117d5d7 | https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/ssh.py#L39-L65 |
249,290 | cirruscluster/cirruscluster | cirruscluster/ext/ansible/runner/connection_plugins/ssh.py | Connection.fetch_file | def fetch_file(self, in_path, out_path):
''' fetch a file from remote to local '''
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)
cmd = self._password_cmd()
if C.DEFAULT_SCP_IF_SSH:
cmd += ["scp"] + self.common_args
cmd += [self.host + ":" + in_path,... | python | def fetch_file(self, in_path, out_path):
''' fetch a file from remote to local '''
vvv("FETCH %s TO %s" % (in_path, out_path), host=self.host)
cmd = self._password_cmd()
if C.DEFAULT_SCP_IF_SSH:
cmd += ["scp"] + self.common_args
cmd += [self.host + ":" + in_path,... | [
"def",
"fetch_file",
"(",
"self",
",",
"in_path",
",",
"out_path",
")",
":",
"vvv",
"(",
"\"FETCH %s TO %s\"",
"%",
"(",
"in_path",
",",
"out_path",
")",
",",
"host",
"=",
"self",
".",
"host",
")",
"cmd",
"=",
"self",
".",
"_password_cmd",
"(",
")",
... | fetch a file from remote to local | [
"fetch",
"a",
"file",
"from",
"remote",
"to",
"local"
] | 977409929dd81322d886425cdced10608117d5d7 | https://github.com/cirruscluster/cirruscluster/blob/977409929dd81322d886425cdced10608117d5d7/cirruscluster/ext/ansible/runner/connection_plugins/ssh.py#L182-L201 |
249,291 | minhhoit/yacms | yacms/blog/admin.py | BlogPostAdmin.save_form | def save_form(self, request, form, change):
"""
Super class ordering is important here - user must get saved first.
"""
OwnableAdmin.save_form(self, request, form, change)
return DisplayableAdmin.save_form(self, request, form, change) | python | def save_form(self, request, form, change):
"""
Super class ordering is important here - user must get saved first.
"""
OwnableAdmin.save_form(self, request, form, change)
return DisplayableAdmin.save_form(self, request, form, change) | [
"def",
"save_form",
"(",
"self",
",",
"request",
",",
"form",
",",
"change",
")",
":",
"OwnableAdmin",
".",
"save_form",
"(",
"self",
",",
"request",
",",
"form",
",",
"change",
")",
"return",
"DisplayableAdmin",
".",
"save_form",
"(",
"self",
",",
"requ... | Super class ordering is important here - user must get saved first. | [
"Super",
"class",
"ordering",
"is",
"important",
"here",
"-",
"user",
"must",
"get",
"saved",
"first",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/blog/admin.py#L38-L43 |
249,292 | minhhoit/yacms | yacms/blog/admin.py | BlogCategoryAdmin.has_module_permission | def has_module_permission(self, request):
"""
Hide from the admin menu unless explicitly set in ``ADMIN_MENU_ORDER``.
"""
for (name, items) in settings.ADMIN_MENU_ORDER:
if "blog.BlogCategory" in items:
return True
return False | python | def has_module_permission(self, request):
"""
Hide from the admin menu unless explicitly set in ``ADMIN_MENU_ORDER``.
"""
for (name, items) in settings.ADMIN_MENU_ORDER:
if "blog.BlogCategory" in items:
return True
return False | [
"def",
"has_module_permission",
"(",
"self",
",",
"request",
")",
":",
"for",
"(",
"name",
",",
"items",
")",
"in",
"settings",
".",
"ADMIN_MENU_ORDER",
":",
"if",
"\"blog.BlogCategory\"",
"in",
"items",
":",
"return",
"True",
"return",
"False"
] | Hide from the admin menu unless explicitly set in ``ADMIN_MENU_ORDER``. | [
"Hide",
"from",
"the",
"admin",
"menu",
"unless",
"explicitly",
"set",
"in",
"ADMIN_MENU_ORDER",
"."
] | 2921b706b7107c6e8c5f2bbf790ff11f85a2167f | https://github.com/minhhoit/yacms/blob/2921b706b7107c6e8c5f2bbf790ff11f85a2167f/yacms/blog/admin.py#L54-L61 |
249,293 | rackerlabs/rackspace-python-neutronclient | neutronclient/common/utils.py | env | def env(*vars, **kwargs):
"""Returns the first environment variable set.
If none are non-empty, defaults to '' or keyword arg default.
"""
for v in vars:
value = os.environ.get(v)
if value:
return value
return kwargs.get('default', '') | python | def env(*vars, **kwargs):
"""Returns the first environment variable set.
If none are non-empty, defaults to '' or keyword arg default.
"""
for v in vars:
value = os.environ.get(v)
if value:
return value
return kwargs.get('default', '') | [
"def",
"env",
"(",
"*",
"vars",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"v",
"in",
"vars",
":",
"value",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"v",
")",
"if",
"value",
":",
"return",
"value",
"return",
"kwargs",
".",
"get",
"(",
"'defau... | Returns the first environment variable set.
If none are non-empty, defaults to '' or keyword arg default. | [
"Returns",
"the",
"first",
"environment",
"variable",
"set",
"."
] | 5a5009a8fe078e3aa1d582176669f1b28ab26bef | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/common/utils.py#L37-L46 |
249,294 | rackerlabs/rackspace-python-neutronclient | neutronclient/common/utils.py | get_client_class | def get_client_class(api_name, version, version_map):
"""Returns the client class for the requested API version.
:param api_name: the name of the API, e.g. 'compute', 'image', etc
:param version: the requested API version
:param version_map: a dict of client classes keyed by version
:rtype: a clien... | python | def get_client_class(api_name, version, version_map):
"""Returns the client class for the requested API version.
:param api_name: the name of the API, e.g. 'compute', 'image', etc
:param version: the requested API version
:param version_map: a dict of client classes keyed by version
:rtype: a clien... | [
"def",
"get_client_class",
"(",
"api_name",
",",
"version",
",",
"version_map",
")",
":",
"try",
":",
"client_path",
"=",
"version_map",
"[",
"str",
"(",
"version",
")",
"]",
"except",
"(",
"KeyError",
",",
"ValueError",
")",
":",
"msg",
"=",
"_",
"(",
... | Returns the client class for the requested API version.
:param api_name: the name of the API, e.g. 'compute', 'image', etc
:param version: the requested API version
:param version_map: a dict of client classes keyed by version
:rtype: a client class for the requested API version | [
"Returns",
"the",
"client",
"class",
"for",
"the",
"requested",
"API",
"version",
"."
] | 5a5009a8fe078e3aa1d582176669f1b28ab26bef | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/common/utils.py#L57-L74 |
249,295 | rackerlabs/rackspace-python-neutronclient | neutronclient/common/utils.py | get_item_properties | def get_item_properties(item, fields, mixed_case_fields=(), formatters=None):
"""Return a tuple containing the item properties.
:param item: a single item resource (e.g. Server, Tenant, etc)
:param fields: tuple of strings with the desired field names
:param mixed_case_fields: tuple of field names to p... | python | def get_item_properties(item, fields, mixed_case_fields=(), formatters=None):
"""Return a tuple containing the item properties.
:param item: a single item resource (e.g. Server, Tenant, etc)
:param fields: tuple of strings with the desired field names
:param mixed_case_fields: tuple of field names to p... | [
"def",
"get_item_properties",
"(",
"item",
",",
"fields",
",",
"mixed_case_fields",
"=",
"(",
")",
",",
"formatters",
"=",
"None",
")",
":",
"if",
"formatters",
"is",
"None",
":",
"formatters",
"=",
"{",
"}",
"row",
"=",
"[",
"]",
"for",
"field",
"in",... | Return a tuple containing the item properties.
:param item: a single item resource (e.g. Server, Tenant, etc)
:param fields: tuple of strings with the desired field names
:param mixed_case_fields: tuple of field names to preserve case
:param formatters: dictionary mapping field names to callables
... | [
"Return",
"a",
"tuple",
"containing",
"the",
"item",
"properties",
"."
] | 5a5009a8fe078e3aa1d582176669f1b28ab26bef | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/common/utils.py#L77-L106 |
249,296 | rackerlabs/rackspace-python-neutronclient | neutronclient/common/utils.py | str2dict | def str2dict(strdict, required_keys=None, optional_keys=None):
"""Convert key1=value1,key2=value2,... string into dictionary.
:param strdict: string in the form of key1=value1,key2=value2
:param required_keys: list of required keys. All keys in this list must be
specified. Otherwise ... | python | def str2dict(strdict, required_keys=None, optional_keys=None):
"""Convert key1=value1,key2=value2,... string into dictionary.
:param strdict: string in the form of key1=value1,key2=value2
:param required_keys: list of required keys. All keys in this list must be
specified. Otherwise ... | [
"def",
"str2dict",
"(",
"strdict",
",",
"required_keys",
"=",
"None",
",",
"optional_keys",
"=",
"None",
")",
":",
"result",
"=",
"{",
"}",
"if",
"strdict",
":",
"for",
"kv",
"in",
"strdict",
".",
"split",
"(",
"','",
")",
":",
"key",
",",
"sep",
"... | Convert key1=value1,key2=value2,... string into dictionary.
:param strdict: string in the form of key1=value1,key2=value2
:param required_keys: list of required keys. All keys in this list must be
specified. Otherwise ArgumentTypeError will be raised.
If this param... | [
"Convert",
"key1",
"=",
"value1",
"key2",
"=",
"value2",
"...",
"string",
"into",
"dictionary",
"."
] | 5a5009a8fe078e3aa1d582176669f1b28ab26bef | https://github.com/rackerlabs/rackspace-python-neutronclient/blob/5a5009a8fe078e3aa1d582176669f1b28ab26bef/neutronclient/common/utils.py#L115-L153 |
249,297 | dossier/dossier.fc | python/dossier/fc/feature_collection.py | FeatureCollection.loads | def loads(cls, data):
'''Create a feature collection from a CBOR byte string.'''
rep = cbor.loads(data)
if not isinstance(rep, Sequence):
raise SerializationError('expected a CBOR list')
if len(rep) != 2:
raise SerializationError('expected a CBOR list of 2 items')... | python | def loads(cls, data):
'''Create a feature collection from a CBOR byte string.'''
rep = cbor.loads(data)
if not isinstance(rep, Sequence):
raise SerializationError('expected a CBOR list')
if len(rep) != 2:
raise SerializationError('expected a CBOR list of 2 items')... | [
"def",
"loads",
"(",
"cls",
",",
"data",
")",
":",
"rep",
"=",
"cbor",
".",
"loads",
"(",
"data",
")",
"if",
"not",
"isinstance",
"(",
"rep",
",",
"Sequence",
")",
":",
"raise",
"SerializationError",
"(",
"'expected a CBOR list'",
")",
"if",
"len",
"("... | Create a feature collection from a CBOR byte string. | [
"Create",
"a",
"feature",
"collection",
"from",
"a",
"CBOR",
"byte",
"string",
"."
] | 3e969d0cb2592fc06afc1c849d2b22283450b5e2 | https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L185-L201 |
249,298 | dossier/dossier.fc | python/dossier/fc/feature_collection.py | FeatureCollection.dumps | def dumps(self):
'''Create a CBOR byte string from a feature collection.'''
metadata = {'v': 'fc01'}
if self.read_only:
metadata['ro'] = 1
rep = [metadata, self.to_dict()]
return cbor.dumps(rep) | python | def dumps(self):
'''Create a CBOR byte string from a feature collection.'''
metadata = {'v': 'fc01'}
if self.read_only:
metadata['ro'] = 1
rep = [metadata, self.to_dict()]
return cbor.dumps(rep) | [
"def",
"dumps",
"(",
"self",
")",
":",
"metadata",
"=",
"{",
"'v'",
":",
"'fc01'",
"}",
"if",
"self",
".",
"read_only",
":",
"metadata",
"[",
"'ro'",
"]",
"=",
"1",
"rep",
"=",
"[",
"metadata",
",",
"self",
".",
"to_dict",
"(",
")",
"]",
"return"... | Create a CBOR byte string from a feature collection. | [
"Create",
"a",
"CBOR",
"byte",
"string",
"from",
"a",
"feature",
"collection",
"."
] | 3e969d0cb2592fc06afc1c849d2b22283450b5e2 | https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L203-L209 |
249,299 | dossier/dossier.fc | python/dossier/fc/feature_collection.py | FeatureCollection.from_dict | def from_dict(cls, data, read_only=False):
'''Recreate a feature collection from a dictionary.
The dictionary is of the format dumped by :meth:`to_dict`.
Additional information, such as whether the feature collection
should be read-only, is not included in this dictionary, and
i... | python | def from_dict(cls, data, read_only=False):
'''Recreate a feature collection from a dictionary.
The dictionary is of the format dumped by :meth:`to_dict`.
Additional information, such as whether the feature collection
should be read-only, is not included in this dictionary, and
i... | [
"def",
"from_dict",
"(",
"cls",
",",
"data",
",",
"read_only",
"=",
"False",
")",
":",
"fc",
"=",
"cls",
"(",
"read_only",
"=",
"read_only",
")",
"fc",
".",
"_features",
"=",
"{",
"}",
"fc",
".",
"_from_dict_update",
"(",
"data",
")",
"return",
"fc"
... | Recreate a feature collection from a dictionary.
The dictionary is of the format dumped by :meth:`to_dict`.
Additional information, such as whether the feature collection
should be read-only, is not included in this dictionary, and
is instead passed as parameters to this function. | [
"Recreate",
"a",
"feature",
"collection",
"from",
"a",
"dictionary",
"."
] | 3e969d0cb2592fc06afc1c849d2b22283450b5e2 | https://github.com/dossier/dossier.fc/blob/3e969d0cb2592fc06afc1c849d2b22283450b5e2/python/dossier/fc/feature_collection.py#L212-L224 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.