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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
44,600 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.has_linguist_args | def has_linguist_args(self, args):
"""
Parses the given args and returns True if they contain
linguist lookups.
"""
linguist_args = []
for arg in args:
condition = self._get_linguist_condition(arg)
if condition:
linguist_args.append... | python | def has_linguist_args(self, args):
"""
Parses the given args and returns True if they contain
linguist lookups.
"""
linguist_args = []
for arg in args:
condition = self._get_linguist_condition(arg)
if condition:
linguist_args.append... | [
"def",
"has_linguist_args",
"(",
"self",
",",
"args",
")",
":",
"linguist_args",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"condition",
"=",
"self",
".",
"_get_linguist_condition",
"(",
"arg",
")",
"if",
"condition",
":",
"linguist_args",
".",
"appen... | Parses the given args and returns True if they contain
linguist lookups. | [
"Parses",
"the",
"given",
"args",
"and",
"returns",
"True",
"if",
"they",
"contain",
"linguist",
"lookups",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L154-L164 |
44,601 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.get_translation_args | def get_translation_args(self, args):
"""
Returns linguist args from model args.
"""
translation_args = []
for arg in args:
condition = self._get_linguist_condition(arg, transform=True)
if condition:
translation_args.append(condition)
... | python | def get_translation_args(self, args):
"""
Returns linguist args from model args.
"""
translation_args = []
for arg in args:
condition = self._get_linguist_condition(arg, transform=True)
if condition:
translation_args.append(condition)
... | [
"def",
"get_translation_args",
"(",
"self",
",",
"args",
")",
":",
"translation_args",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"condition",
"=",
"self",
".",
"_get_linguist_condition",
"(",
"arg",
",",
"transform",
"=",
"True",
")",
"if",
"conditio... | Returns linguist args from model args. | [
"Returns",
"linguist",
"args",
"from",
"model",
"args",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L166-L175 |
44,602 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.is_linguist_lookup | def is_linguist_lookup(self, lookup):
"""
Returns true if the given lookup is a valid linguist lookup.
"""
field = utils.get_field_name_from_lookup(lookup)
# To keep default behavior with "FieldError: Cannot resolve keyword".
if (
field not in self.concrete_f... | python | def is_linguist_lookup(self, lookup):
"""
Returns true if the given lookup is a valid linguist lookup.
"""
field = utils.get_field_name_from_lookup(lookup)
# To keep default behavior with "FieldError: Cannot resolve keyword".
if (
field not in self.concrete_f... | [
"def",
"is_linguist_lookup",
"(",
"self",
",",
"lookup",
")",
":",
"field",
"=",
"utils",
".",
"get_field_name_from_lookup",
"(",
"lookup",
")",
"# To keep default behavior with \"FieldError: Cannot resolve keyword\".",
"if",
"(",
"field",
"not",
"in",
"self",
".",
"c... | Returns true if the given lookup is a valid linguist lookup. | [
"Returns",
"true",
"if",
"the",
"given",
"lookup",
"is",
"a",
"valid",
"linguist",
"lookup",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L196-L209 |
44,603 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin._get_linguist_condition | def _get_linguist_condition(self, condition, reverse=False, transform=False):
"""
Parses Q tree and returns linguist lookups or model lookups
if reverse is True.
"""
# We deal with a node
if isinstance(condition, Q):
children = []
for child in cond... | python | def _get_linguist_condition(self, condition, reverse=False, transform=False):
"""
Parses Q tree and returns linguist lookups or model lookups
if reverse is True.
"""
# We deal with a node
if isinstance(condition, Q):
children = []
for child in cond... | [
"def",
"_get_linguist_condition",
"(",
"self",
",",
"condition",
",",
"reverse",
"=",
"False",
",",
"transform",
"=",
"False",
")",
":",
"# We deal with a node",
"if",
"isinstance",
"(",
"condition",
",",
"Q",
")",
":",
"children",
"=",
"[",
"]",
"for",
"c... | Parses Q tree and returns linguist lookups or model lookups
if reverse is True. | [
"Parses",
"Q",
"tree",
"and",
"returns",
"linguist",
"lookups",
"or",
"model",
"lookups",
"if",
"reverse",
"is",
"True",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L211-L246 |
44,604 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.get_cleaned_args | def get_cleaned_args(self, args):
"""
Returns positional arguments for related model query.
"""
if not args:
return args
cleaned_args = []
for arg in args:
condition = self._get_linguist_condition(arg, True)
if condition:
... | python | def get_cleaned_args(self, args):
"""
Returns positional arguments for related model query.
"""
if not args:
return args
cleaned_args = []
for arg in args:
condition = self._get_linguist_condition(arg, True)
if condition:
... | [
"def",
"get_cleaned_args",
"(",
"self",
",",
"args",
")",
":",
"if",
"not",
"args",
":",
"return",
"args",
"cleaned_args",
"=",
"[",
"]",
"for",
"arg",
"in",
"args",
":",
"condition",
"=",
"self",
".",
"_get_linguist_condition",
"(",
"arg",
",",
"True",
... | Returns positional arguments for related model query. | [
"Returns",
"positional",
"arguments",
"for",
"related",
"model",
"query",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L248-L261 |
44,605 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.get_cleaned_kwargs | def get_cleaned_kwargs(self, kwargs):
"""
Returns concrete field lookups.
"""
cleaned_kwargs = kwargs.copy()
if kwargs is not None:
for k in kwargs:
if self.is_linguist_lookup(k):
del cleaned_kwargs[k]
return cleaned_kwarg... | python | def get_cleaned_kwargs(self, kwargs):
"""
Returns concrete field lookups.
"""
cleaned_kwargs = kwargs.copy()
if kwargs is not None:
for k in kwargs:
if self.is_linguist_lookup(k):
del cleaned_kwargs[k]
return cleaned_kwarg... | [
"def",
"get_cleaned_kwargs",
"(",
"self",
",",
"kwargs",
")",
":",
"cleaned_kwargs",
"=",
"kwargs",
".",
"copy",
"(",
")",
"if",
"kwargs",
"is",
"not",
"None",
":",
"for",
"k",
"in",
"kwargs",
":",
"if",
"self",
".",
"is_linguist_lookup",
"(",
"k",
")"... | Returns concrete field lookups. | [
"Returns",
"concrete",
"field",
"lookups",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L263-L274 |
44,606 | ulule/django-linguist | linguist/mixins.py | QuerySetMixin.with_translations | def with_translations(self, **kwargs):
"""
Prefetches translations.
Takes three optional keyword arguments:
* ``field_names``: ``field_name`` values for SELECT IN
* ``languages``: ``language`` values for SELECT IN
* ``chunks_length``: fetches IDs by chunk
"""
... | python | def with_translations(self, **kwargs):
"""
Prefetches translations.
Takes three optional keyword arguments:
* ``field_names``: ``field_name`` values for SELECT IN
* ``languages``: ``language`` values for SELECT IN
* ``chunks_length``: fetches IDs by chunk
"""
... | [
"def",
"with_translations",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"force",
"=",
"kwargs",
".",
"pop",
"(",
"\"force\"",
",",
"False",
")",
"if",
"self",
".",
"_prefetch_translations_done",
"and",
"force",
"is",
"False",
":",
"return",
"self",
"... | Prefetches translations.
Takes three optional keyword arguments:
* ``field_names``: ``field_name`` values for SELECT IN
* ``languages``: ``language`` values for SELECT IN
* ``chunks_length``: fetches IDs by chunk | [
"Prefetches",
"translations",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L276-L297 |
44,607 | ulule/django-linguist | linguist/mixins.py | ModelMixin.available_languages | def available_languages(self):
"""
Returns available languages.
"""
from .models import Translation
return (
Translation.objects.filter(
identifier=self.linguist_identifier, object_id=self.pk
)
.values_list("language", flat=Tru... | python | def available_languages(self):
"""
Returns available languages.
"""
from .models import Translation
return (
Translation.objects.filter(
identifier=self.linguist_identifier, object_id=self.pk
)
.values_list("language", flat=Tru... | [
"def",
"available_languages",
"(",
"self",
")",
":",
"from",
".",
"models",
"import",
"Translation",
"return",
"(",
"Translation",
".",
"objects",
".",
"filter",
"(",
"identifier",
"=",
"self",
".",
"linguist_identifier",
",",
"object_id",
"=",
"self",
".",
... | Returns available languages. | [
"Returns",
"available",
"languages",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L381-L394 |
44,608 | ulule/django-linguist | linguist/mixins.py | ModelMixin.delete_translations | def delete_translations(self, language=None):
"""
Deletes related translations.
"""
from .models import Translation
return Translation.objects.delete_translations(obj=self, language=language) | python | def delete_translations(self, language=None):
"""
Deletes related translations.
"""
from .models import Translation
return Translation.objects.delete_translations(obj=self, language=language) | [
"def",
"delete_translations",
"(",
"self",
",",
"language",
"=",
"None",
")",
":",
"from",
".",
"models",
"import",
"Translation",
"return",
"Translation",
".",
"objects",
".",
"delete_translations",
"(",
"obj",
"=",
"self",
",",
"language",
"=",
"language",
... | Deletes related translations. | [
"Deletes",
"related",
"translations",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L420-L426 |
44,609 | ulule/django-linguist | linguist/mixins.py | ModelMixin.override_language | def override_language(self, language):
"""
Context manager to override the instance language.
"""
previous_language = self._linguist.language
self._linguist.language = language
yield
self._linguist.language = previous_language | python | def override_language(self, language):
"""
Context manager to override the instance language.
"""
previous_language = self._linguist.language
self._linguist.language = language
yield
self._linguist.language = previous_language | [
"def",
"override_language",
"(",
"self",
",",
"language",
")",
":",
"previous_language",
"=",
"self",
".",
"_linguist",
".",
"language",
"self",
".",
"_linguist",
".",
"language",
"=",
"language",
"yield",
"self",
".",
"_linguist",
".",
"language",
"=",
"pre... | Context manager to override the instance language. | [
"Context",
"manager",
"to",
"override",
"the",
"instance",
"language",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/mixins.py#L435-L442 |
44,610 | ulule/django-linguist | linguist/metaclasses.py | validate_meta | def validate_meta(meta):
"""
Validates Linguist Meta attribute.
"""
if not isinstance(meta, (dict,)):
raise TypeError('Model Meta "linguist" must be a dict')
required_keys = ("identifier", "fields")
for key in required_keys:
if key not in meta:
raise KeyError('Model... | python | def validate_meta(meta):
"""
Validates Linguist Meta attribute.
"""
if not isinstance(meta, (dict,)):
raise TypeError('Model Meta "linguist" must be a dict')
required_keys = ("identifier", "fields")
for key in required_keys:
if key not in meta:
raise KeyError('Model... | [
"def",
"validate_meta",
"(",
"meta",
")",
":",
"if",
"not",
"isinstance",
"(",
"meta",
",",
"(",
"dict",
",",
")",
")",
":",
"raise",
"TypeError",
"(",
"'Model Meta \"linguist\" must be a dict'",
")",
"required_keys",
"=",
"(",
"\"identifier\"",
",",
"\"fields... | Validates Linguist Meta attribute. | [
"Validates",
"Linguist",
"Meta",
"attribute",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/metaclasses.py#L22-L38 |
44,611 | ulule/django-linguist | linguist/metaclasses.py | default_value_setter | def default_value_setter(field):
"""
When setting to the name of the field itself, the value
in the current language will be set.
"""
def default_value_func_setter(self, value):
localized_field = utils.build_localized_field_name(
field, self._linguist.active_language
)
... | python | def default_value_setter(field):
"""
When setting to the name of the field itself, the value
in the current language will be set.
"""
def default_value_func_setter(self, value):
localized_field = utils.build_localized_field_name(
field, self._linguist.active_language
)
... | [
"def",
"default_value_setter",
"(",
"field",
")",
":",
"def",
"default_value_func_setter",
"(",
"self",
",",
"value",
")",
":",
"localized_field",
"=",
"utils",
".",
"build_localized_field_name",
"(",
"field",
",",
"self",
".",
"_linguist",
".",
"active_language",... | When setting to the name of the field itself, the value
in the current language will be set. | [
"When",
"setting",
"to",
"the",
"name",
"of",
"the",
"field",
"itself",
"the",
"value",
"in",
"the",
"current",
"language",
"will",
"be",
"set",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/metaclasses.py#L62-L75 |
44,612 | ulule/django-linguist | linguist/metaclasses.py | field_factory | def field_factory(base_class):
"""
Takes a field base class and wrap it with ``TranslationField`` class.
"""
from .fields import TranslationField
class TranslationFieldField(TranslationField, base_class):
pass
TranslationFieldField.__name__ = "Translation%s" % base_class.__name__
... | python | def field_factory(base_class):
"""
Takes a field base class and wrap it with ``TranslationField`` class.
"""
from .fields import TranslationField
class TranslationFieldField(TranslationField, base_class):
pass
TranslationFieldField.__name__ = "Translation%s" % base_class.__name__
... | [
"def",
"field_factory",
"(",
"base_class",
")",
":",
"from",
".",
"fields",
"import",
"TranslationField",
"class",
"TranslationFieldField",
"(",
"TranslationField",
",",
"base_class",
")",
":",
"pass",
"TranslationFieldField",
".",
"__name__",
"=",
"\"Translation%s\""... | Takes a field base class and wrap it with ``TranslationField`` class. | [
"Takes",
"a",
"field",
"base",
"class",
"and",
"wrap",
"it",
"with",
"TranslationField",
"class",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/metaclasses.py#L88-L99 |
44,613 | ulule/django-linguist | linguist/metaclasses.py | create_translation_field | def create_translation_field(translated_field, language):
"""
Takes the original field, a given language, a decider model and return a
Field class for model.
"""
cls_name = translated_field.__class__.__name__
if not isinstance(translated_field, tuple(SUPPORTED_FIELDS.keys())):
raise Imp... | python | def create_translation_field(translated_field, language):
"""
Takes the original field, a given language, a decider model and return a
Field class for model.
"""
cls_name = translated_field.__class__.__name__
if not isinstance(translated_field, tuple(SUPPORTED_FIELDS.keys())):
raise Imp... | [
"def",
"create_translation_field",
"(",
"translated_field",
",",
"language",
")",
":",
"cls_name",
"=",
"translated_field",
".",
"__class__",
".",
"__name__",
"if",
"not",
"isinstance",
"(",
"translated_field",
",",
"tuple",
"(",
"SUPPORTED_FIELDS",
".",
"keys",
"... | Takes the original field, a given language, a decider model and return a
Field class for model. | [
"Takes",
"the",
"original",
"field",
"a",
"given",
"language",
"a",
"decider",
"model",
"and",
"return",
"a",
"Field",
"class",
"for",
"model",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/metaclasses.py#L102-L117 |
44,614 | afg984/pyardrone | pyardrone/abc.py | BaseClient.connect | def connect(self):
'''
Connect to the drone.
:raises RuntimeError: if the drone is connected or closed already.
'''
if self.connected:
raise RuntimeError(
'{} is connected already'.format(self.__class__.__name__))
if self.closed:
r... | python | def connect(self):
'''
Connect to the drone.
:raises RuntimeError: if the drone is connected or closed already.
'''
if self.connected:
raise RuntimeError(
'{} is connected already'.format(self.__class__.__name__))
if self.closed:
r... | [
"def",
"connect",
"(",
"self",
")",
":",
"if",
"self",
".",
"connected",
":",
"raise",
"RuntimeError",
"(",
"'{} is connected already'",
".",
"format",
"(",
"self",
".",
"__class__",
".",
"__name__",
")",
")",
"if",
"self",
".",
"closed",
":",
"raise",
"... | Connect to the drone.
:raises RuntimeError: if the drone is connected or closed already. | [
"Connect",
"to",
"the",
"drone",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/abc.py#L9-L22 |
44,615 | afg984/pyardrone | pyardrone/abc.py | BaseClient.close | def close(self):
'''
Exit all threads and disconnect the drone.
This method has no effect if the drone is closed already or not
connected yet.
'''
if not self.connected:
return
if self.closed:
return
self.closed = True
self... | python | def close(self):
'''
Exit all threads and disconnect the drone.
This method has no effect if the drone is closed already or not
connected yet.
'''
if not self.connected:
return
if self.closed:
return
self.closed = True
self... | [
"def",
"close",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"connected",
":",
"return",
"if",
"self",
".",
"closed",
":",
"return",
"self",
".",
"closed",
"=",
"True",
"self",
".",
"_close",
"(",
")"
] | Exit all threads and disconnect the drone.
This method has no effect if the drone is closed already or not
connected yet. | [
"Exit",
"all",
"threads",
"and",
"disconnect",
"the",
"drone",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/abc.py#L24-L36 |
44,616 | afg984/pyardrone | pyardrone/at/parameters.py | Int32._set_flags | def _set_flags(self, **flags):
'''
Set the flags of this argument.
Example: ``int_param._set_flags(a=1, b=2, c=4, d=8)``
'''
self._flags = enum.IntEnum('_flags', flags)
self.__dict__.update(self._flags.__members__)
self._patch_flag_doc() | python | def _set_flags(self, **flags):
'''
Set the flags of this argument.
Example: ``int_param._set_flags(a=1, b=2, c=4, d=8)``
'''
self._flags = enum.IntEnum('_flags', flags)
self.__dict__.update(self._flags.__members__)
self._patch_flag_doc() | [
"def",
"_set_flags",
"(",
"self",
",",
"*",
"*",
"flags",
")",
":",
"self",
".",
"_flags",
"=",
"enum",
".",
"IntEnum",
"(",
"'_flags'",
",",
"flags",
")",
"self",
".",
"__dict__",
".",
"update",
"(",
"self",
".",
"_flags",
".",
"__members__",
")",
... | Set the flags of this argument.
Example: ``int_param._set_flags(a=1, b=2, c=4, d=8)`` | [
"Set",
"the",
"flags",
"of",
"this",
"argument",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/at/parameters.py#L86-L94 |
44,617 | ulule/django-linguist | linguist/signals.py | delete_translations | def delete_translations(sender, instance, **kwargs):
"""
Deletes related instance's translations when instance is deleted.
"""
if issubclass(sender, (ModelMixin,)):
instance._linguist.decider.objects.filter(
identifier=instance.linguist_identifier, object_id=instance.pk
).del... | python | def delete_translations(sender, instance, **kwargs):
"""
Deletes related instance's translations when instance is deleted.
"""
if issubclass(sender, (ModelMixin,)):
instance._linguist.decider.objects.filter(
identifier=instance.linguist_identifier, object_id=instance.pk
).del... | [
"def",
"delete_translations",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"issubclass",
"(",
"sender",
",",
"(",
"ModelMixin",
",",
")",
")",
":",
"instance",
".",
"_linguist",
".",
"decider",
".",
"objects",
".",
"filter",
... | Deletes related instance's translations when instance is deleted. | [
"Deletes",
"related",
"instance",
"s",
"translations",
"when",
"instance",
"is",
"deleted",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/signals.py#L9-L16 |
44,618 | mbr/asciitree | asciitree/__init__.py | draw_tree | def draw_tree(node,
child_iter=lambda n: n.children,
text_str=str):
"""Support asciitree 0.2 API.
This function solely exist to not break old code (using asciitree 0.2).
Its use is deprecated."""
return LeftAligned(traverse=Traversal(get_text=text_str,
... | python | def draw_tree(node,
child_iter=lambda n: n.children,
text_str=str):
"""Support asciitree 0.2 API.
This function solely exist to not break old code (using asciitree 0.2).
Its use is deprecated."""
return LeftAligned(traverse=Traversal(get_text=text_str,
... | [
"def",
"draw_tree",
"(",
"node",
",",
"child_iter",
"=",
"lambda",
"n",
":",
"n",
".",
"children",
",",
"text_str",
"=",
"str",
")",
":",
"return",
"LeftAligned",
"(",
"traverse",
"=",
"Traversal",
"(",
"get_text",
"=",
"text_str",
",",
"get_children",
"... | Support asciitree 0.2 API.
This function solely exist to not break old code (using asciitree 0.2).
Its use is deprecated. | [
"Support",
"asciitree",
"0",
".",
"2",
"API",
"."
] | 29712fb66fd997b4345ac4f4436c8dc6401924de | https://github.com/mbr/asciitree/blob/29712fb66fd997b4345ac4f4436c8dc6401924de/asciitree/__init__.py#L74-L83 |
44,619 | ulule/django-linguist | linguist/utils.py | get_language | def get_language():
"""
Returns an active language code that is guaranteed to be in
settings.SUPPORTED_LANGUAGES.
"""
lang = _get_language()
if not lang:
return get_fallback_language()
langs = [l[0] for l in settings.SUPPORTED_LANGUAGES]
if lang not in langs and "-" in lang:
... | python | def get_language():
"""
Returns an active language code that is guaranteed to be in
settings.SUPPORTED_LANGUAGES.
"""
lang = _get_language()
if not lang:
return get_fallback_language()
langs = [l[0] for l in settings.SUPPORTED_LANGUAGES]
if lang not in langs and "-" in lang:
... | [
"def",
"get_language",
"(",
")",
":",
"lang",
"=",
"_get_language",
"(",
")",
"if",
"not",
"lang",
":",
"return",
"get_fallback_language",
"(",
")",
"langs",
"=",
"[",
"l",
"[",
"0",
"]",
"for",
"l",
"in",
"settings",
".",
"SUPPORTED_LANGUAGES",
"]",
"... | Returns an active language code that is guaranteed to be in
settings.SUPPORTED_LANGUAGES. | [
"Returns",
"an",
"active",
"language",
"code",
"that",
"is",
"guaranteed",
"to",
"be",
"in",
"settings",
".",
"SUPPORTED_LANGUAGES",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/utils.py#L30-L47 |
44,620 | ulule/django-linguist | linguist/utils.py | activate_language | def activate_language(instances, language):
"""
Activates the given language for the given instances.
"""
language = (
language if language in get_supported_languages() else get_fallback_language()
)
for instance in instances:
instance.activate_language(language) | python | def activate_language(instances, language):
"""
Activates the given language for the given instances.
"""
language = (
language if language in get_supported_languages() else get_fallback_language()
)
for instance in instances:
instance.activate_language(language) | [
"def",
"activate_language",
"(",
"instances",
",",
"language",
")",
":",
"language",
"=",
"(",
"language",
"if",
"language",
"in",
"get_supported_languages",
"(",
")",
"else",
"get_fallback_language",
"(",
")",
")",
"for",
"instance",
"in",
"instances",
":",
"... | Activates the given language for the given instances. | [
"Activates",
"the",
"given",
"language",
"for",
"the",
"given",
"instances",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/utils.py#L85-L93 |
44,621 | ulule/django-linguist | linguist/utils.py | load_class | def load_class(class_path, setting_name=None):
"""
Loads a class given a class_path. The setting value may be a string or a
tuple. The setting_name parameter is only there for pretty error output, and
therefore is optional.
"""
if not isinstance(class_path, six.string_types):
try:
... | python | def load_class(class_path, setting_name=None):
"""
Loads a class given a class_path. The setting value may be a string or a
tuple. The setting_name parameter is only there for pretty error output, and
therefore is optional.
"""
if not isinstance(class_path, six.string_types):
try:
... | [
"def",
"load_class",
"(",
"class_path",
",",
"setting_name",
"=",
"None",
")",
":",
"if",
"not",
"isinstance",
"(",
"class_path",
",",
"six",
".",
"string_types",
")",
":",
"try",
":",
"class_path",
",",
"app_label",
"=",
"class_path",
"except",
":",
"if",... | Loads a class given a class_path. The setting value may be a string or a
tuple. The setting_name parameter is only there for pretty error output, and
therefore is optional. | [
"Loads",
"a",
"class",
"given",
"a",
"class_path",
".",
"The",
"setting",
"value",
"may",
"be",
"a",
"string",
"or",
"a",
"tuple",
".",
"The",
"setting_name",
"parameter",
"is",
"only",
"there",
"for",
"pretty",
"error",
"output",
"and",
"therefore",
"is",... | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/utils.py#L124-L182 |
44,622 | ulule/django-linguist | linguist/utils.py | get_translation_lookup | def get_translation_lookup(identifier, field, value):
"""
Mapper that takes a language field, its value and returns the
related lookup for Translation model.
"""
# Split by transformers
parts = field.split("__")
# Store transformers
transformers = parts[1:] if len(parts) > 1 else None
... | python | def get_translation_lookup(identifier, field, value):
"""
Mapper that takes a language field, its value and returns the
related lookup for Translation model.
"""
# Split by transformers
parts = field.split("__")
# Store transformers
transformers = parts[1:] if len(parts) > 1 else None
... | [
"def",
"get_translation_lookup",
"(",
"identifier",
",",
"field",
",",
"value",
")",
":",
"# Split by transformers",
"parts",
"=",
"field",
".",
"split",
"(",
"\"__\"",
")",
"# Store transformers",
"transformers",
"=",
"parts",
"[",
"1",
":",
"]",
"if",
"len",... | Mapper that takes a language field, its value and returns the
related lookup for Translation model. | [
"Mapper",
"that",
"takes",
"a",
"language",
"field",
"its",
"value",
"and",
"returns",
"the",
"related",
"lookup",
"for",
"Translation",
"model",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/utils.py#L215-L253 |
44,623 | ulule/django-linguist | linguist/utils.py | get_grouped_translations | def get_grouped_translations(instances, **kwargs):
"""
Takes instances and returns grouped translations ready to
be set in cache.
"""
grouped_translations = collections.defaultdict(list)
if not instances:
return grouped_translations
if not isinstance(instances, collections.Iterable... | python | def get_grouped_translations(instances, **kwargs):
"""
Takes instances and returns grouped translations ready to
be set in cache.
"""
grouped_translations = collections.defaultdict(list)
if not instances:
return grouped_translations
if not isinstance(instances, collections.Iterable... | [
"def",
"get_grouped_translations",
"(",
"instances",
",",
"*",
"*",
"kwargs",
")",
":",
"grouped_translations",
"=",
"collections",
".",
"defaultdict",
"(",
"list",
")",
"if",
"not",
"instances",
":",
"return",
"grouped_translations",
"if",
"not",
"isinstance",
... | Takes instances and returns grouped translations ready to
be set in cache. | [
"Takes",
"instances",
"and",
"returns",
"grouped",
"translations",
"ready",
"to",
"be",
"set",
"in",
"cache",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/utils.py#L263-L324 |
44,624 | afg984/pyardrone | pyardrone/utils/__init__.py | get_free_udp_port | def get_free_udp_port():
'''
Get a free UDP port.
Note this is vlunerable to race conditions.
'''
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 0))
addr = sock.getsockname()
sock.close()
return addr[1] | python | def get_free_udp_port():
'''
Get a free UDP port.
Note this is vlunerable to race conditions.
'''
import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind(('localhost', 0))
addr = sock.getsockname()
sock.close()
return addr[1] | [
"def",
"get_free_udp_port",
"(",
")",
":",
"import",
"socket",
"sock",
"=",
"socket",
".",
"socket",
"(",
"socket",
".",
"AF_INET",
",",
"socket",
".",
"SOCK_STREAM",
")",
"sock",
".",
"bind",
"(",
"(",
"'localhost'",
",",
"0",
")",
")",
"addr",
"=",
... | Get a free UDP port.
Note this is vlunerable to race conditions. | [
"Get",
"a",
"free",
"UDP",
"port",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/utils/__init__.py#L60-L71 |
44,625 | ulule/django-linguist | linguist/admin.py | TranslatableModelAdminMixin.get_available_languages | def get_available_languages(self, obj):
"""
Returns available languages for current object.
"""
return obj.available_languages if obj is not None else self.model.objects.none() | python | def get_available_languages(self, obj):
"""
Returns available languages for current object.
"""
return obj.available_languages if obj is not None else self.model.objects.none() | [
"def",
"get_available_languages",
"(",
"self",
",",
"obj",
")",
":",
"return",
"obj",
".",
"available_languages",
"if",
"obj",
"is",
"not",
"None",
"else",
"self",
".",
"model",
".",
"objects",
".",
"none",
"(",
")"
] | Returns available languages for current object. | [
"Returns",
"available",
"languages",
"for",
"current",
"object",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/admin.py#L43-L47 |
44,626 | ulule/django-linguist | linguist/admin.py | TranslatableModelAdminMixin.languages_column | def languages_column(self, obj):
"""
Adds languages columns.
"""
languages = self.get_available_languages(obj)
return '<span class="available-languages">{0}</span>'.format(
" ".join(languages)
) | python | def languages_column(self, obj):
"""
Adds languages columns.
"""
languages = self.get_available_languages(obj)
return '<span class="available-languages">{0}</span>'.format(
" ".join(languages)
) | [
"def",
"languages_column",
"(",
"self",
",",
"obj",
")",
":",
"languages",
"=",
"self",
".",
"get_available_languages",
"(",
"obj",
")",
"return",
"'<span class=\"available-languages\">{0}</span>'",
".",
"format",
"(",
"\" \"",
".",
"join",
"(",
"languages",
")",
... | Adds languages columns. | [
"Adds",
"languages",
"columns",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/admin.py#L49-L56 |
44,627 | ulule/django-linguist | linguist/helpers.py | prefetch_translations | def prefetch_translations(instances, **kwargs):
"""
Prefetches translations for the given instances.
Can be useful for a list of instances.
"""
from .mixins import ModelMixin
if not isinstance(instances, collections.Iterable):
instances = [instances]
populate_missing = kwargs.get("... | python | def prefetch_translations(instances, **kwargs):
"""
Prefetches translations for the given instances.
Can be useful for a list of instances.
"""
from .mixins import ModelMixin
if not isinstance(instances, collections.Iterable):
instances = [instances]
populate_missing = kwargs.get("... | [
"def",
"prefetch_translations",
"(",
"instances",
",",
"*",
"*",
"kwargs",
")",
":",
"from",
".",
"mixins",
"import",
"ModelMixin",
"if",
"not",
"isinstance",
"(",
"instances",
",",
"collections",
".",
"Iterable",
")",
":",
"instances",
"=",
"[",
"instances"... | Prefetches translations for the given instances.
Can be useful for a list of instances. | [
"Prefetches",
"translations",
"for",
"the",
"given",
"instances",
".",
"Can",
"be",
"useful",
"for",
"a",
"list",
"of",
"instances",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/helpers.py#L8-L34 |
44,628 | ulule/django-linguist | linguist/models/base.py | TranslationQuerySet.get_translations | def get_translations(self, obj, language=None):
"""
Shorcut method to retrieve translations for a given object.
"""
lookup = {"identifier": obj.linguist_identifier, "object_id": obj.pk}
if language is not None:
lookup["language"] = language
return self.get_q... | python | def get_translations(self, obj, language=None):
"""
Shorcut method to retrieve translations for a given object.
"""
lookup = {"identifier": obj.linguist_identifier, "object_id": obj.pk}
if language is not None:
lookup["language"] = language
return self.get_q... | [
"def",
"get_translations",
"(",
"self",
",",
"obj",
",",
"language",
"=",
"None",
")",
":",
"lookup",
"=",
"{",
"\"identifier\"",
":",
"obj",
".",
"linguist_identifier",
",",
"\"object_id\"",
":",
"obj",
".",
"pk",
"}",
"if",
"language",
"is",
"not",
"No... | Shorcut method to retrieve translations for a given object. | [
"Shorcut",
"method",
"to",
"retrieve",
"translations",
"for",
"a",
"given",
"object",
"."
] | d2b95a6ab921039d56d5eeb352badfe5be9e8f77 | https://github.com/ulule/django-linguist/blob/d2b95a6ab921039d56d5eeb352badfe5be9e8f77/linguist/models/base.py#L11-L20 |
44,629 | afg984/pyardrone | pyardrone/__init__.py | HelperMixin.takeoff | def takeoff(self):
'''
Sends the takeoff command.
'''
self.send(at.REF(at.REF.input.start)) | python | def takeoff(self):
'''
Sends the takeoff command.
'''
self.send(at.REF(at.REF.input.start)) | [
"def",
"takeoff",
"(",
"self",
")",
":",
"self",
".",
"send",
"(",
"at",
".",
"REF",
"(",
"at",
".",
"REF",
".",
"input",
".",
"start",
")",
")"
] | Sends the takeoff command. | [
"Sends",
"the",
"takeoff",
"command",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/__init__.py#L101-L105 |
44,630 | afg984/pyardrone | pyardrone/__init__.py | HelperMixin.emergency | def emergency(self):
'''
Sends the emergency command.
'''
self.send(at.REF(at.REF.input.select)) | python | def emergency(self):
'''
Sends the emergency command.
'''
self.send(at.REF(at.REF.input.select)) | [
"def",
"emergency",
"(",
"self",
")",
":",
"self",
".",
"send",
"(",
"at",
".",
"REF",
"(",
"at",
".",
"REF",
".",
"input",
".",
"select",
")",
")"
] | Sends the emergency command. | [
"Sends",
"the",
"emergency",
"command",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/__init__.py#L113-L117 |
44,631 | afg984/pyardrone | pyardrone/__init__.py | HelperMixin.move | def move(
self, *,
forward=0, backward=0,
left=0, right=0,
up=0, down=0,
cw=0, ccw=0):
'''
Moves the drone.
To move the drone forward at 0.8x speed:
>>> drone.move(forward=0.8)
To move the drone right at 0.5x speed an... | python | def move(
self, *,
forward=0, backward=0,
left=0, right=0,
up=0, down=0,
cw=0, ccw=0):
'''
Moves the drone.
To move the drone forward at 0.8x speed:
>>> drone.move(forward=0.8)
To move the drone right at 0.5x speed an... | [
"def",
"move",
"(",
"self",
",",
"*",
",",
"forward",
"=",
"0",
",",
"backward",
"=",
"0",
",",
"left",
"=",
"0",
",",
"right",
"=",
"0",
",",
"up",
"=",
"0",
",",
"down",
"=",
"0",
",",
"cw",
"=",
"0",
",",
"ccw",
"=",
"0",
")",
":",
"... | Moves the drone.
To move the drone forward at 0.8x speed:
>>> drone.move(forward=0.8)
To move the drone right at 0.5x speed and upward at full speed:
>>> drone.move(right=0.5, up=1)
To rotate clockwise at 0.7x speed:
>>> drone.move(cw=0.7)
:param forward: ... | [
"Moves",
"the",
"drone",
"."
] | 2c39263d5fdea91070c20f0ae9c9f355a9b5fe17 | https://github.com/afg984/pyardrone/blob/2c39263d5fdea91070c20f0ae9c9f355a9b5fe17/pyardrone/__init__.py#L126-L161 |
44,632 | jbittel/base32-crockford | base32_crockford.py | encode | def encode(number, checksum=False, split=0):
"""Encode an integer into a symbol string.
A ValueError is raised on invalid input.
If checksum is set to True, a check symbol will be
calculated and appended to the string.
If split is specified, the string will be divided into
clusters of that si... | python | def encode(number, checksum=False, split=0):
"""Encode an integer into a symbol string.
A ValueError is raised on invalid input.
If checksum is set to True, a check symbol will be
calculated and appended to the string.
If split is specified, the string will be divided into
clusters of that si... | [
"def",
"encode",
"(",
"number",
",",
"checksum",
"=",
"False",
",",
"split",
"=",
"0",
")",
":",
"number",
"=",
"int",
"(",
"number",
")",
"if",
"number",
"<",
"0",
":",
"raise",
"ValueError",
"(",
"\"number '%d' is not a positive integer\"",
"%",
"number"... | Encode an integer into a symbol string.
A ValueError is raised on invalid input.
If checksum is set to True, a check symbol will be
calculated and appended to the string.
If split is specified, the string will be divided into
clusters of that size separated by hyphens.
The encoded string is ... | [
"Encode",
"an",
"integer",
"into",
"a",
"symbol",
"string",
"."
] | 1ffb6021485b666ea6a562abd0a1ea6f7021188f | https://github.com/jbittel/base32-crockford/blob/1ffb6021485b666ea6a562abd0a1ea6f7021188f/base32_crockford.py#L59-L100 |
44,633 | jbittel/base32-crockford | base32_crockford.py | decode | def decode(symbol_string, checksum=False, strict=False):
"""Decode an encoded symbol string.
If checksum is set to True, the string is assumed to have a
trailing check symbol which will be validated. If the
checksum validation fails, a ValueError is raised.
If strict is set to True, a ValueError i... | python | def decode(symbol_string, checksum=False, strict=False):
"""Decode an encoded symbol string.
If checksum is set to True, the string is assumed to have a
trailing check symbol which will be validated. If the
checksum validation fails, a ValueError is raised.
If strict is set to True, a ValueError i... | [
"def",
"decode",
"(",
"symbol_string",
",",
"checksum",
"=",
"False",
",",
"strict",
"=",
"False",
")",
":",
"symbol_string",
"=",
"normalize",
"(",
"symbol_string",
",",
"strict",
"=",
"strict",
")",
"if",
"checksum",
":",
"symbol_string",
",",
"check_symbo... | Decode an encoded symbol string.
If checksum is set to True, the string is assumed to have a
trailing check symbol which will be validated. If the
checksum validation fails, a ValueError is raised.
If strict is set to True, a ValueError is raised if the
normalization step requires changes to the s... | [
"Decode",
"an",
"encoded",
"symbol",
"string",
"."
] | 1ffb6021485b666ea6a562abd0a1ea6f7021188f | https://github.com/jbittel/base32-crockford/blob/1ffb6021485b666ea6a562abd0a1ea6f7021188f/base32_crockford.py#L103-L130 |
44,634 | jbittel/base32-crockford | base32_crockford.py | normalize | def normalize(symbol_string, strict=False):
"""Normalize an encoded symbol string.
Normalization provides error correction and prepares the
string for decoding. These transformations are applied:
1. Hyphens are removed
2. 'I', 'i', 'L' or 'l' are converted to '1'
3. 'O' or 'o' are con... | python | def normalize(symbol_string, strict=False):
"""Normalize an encoded symbol string.
Normalization provides error correction and prepares the
string for decoding. These transformations are applied:
1. Hyphens are removed
2. 'I', 'i', 'L' or 'l' are converted to '1'
3. 'O' or 'o' are con... | [
"def",
"normalize",
"(",
"symbol_string",
",",
"strict",
"=",
"False",
")",
":",
"if",
"isinstance",
"(",
"symbol_string",
",",
"string_types",
")",
":",
"if",
"not",
"PY3",
":",
"try",
":",
"symbol_string",
"=",
"symbol_string",
".",
"encode",
"(",
"'asci... | Normalize an encoded symbol string.
Normalization provides error correction and prepares the
string for decoding. These transformations are applied:
1. Hyphens are removed
2. 'I', 'i', 'L' or 'l' are converted to '1'
3. 'O' or 'o' are converted to '0'
4. All characters are converte... | [
"Normalize",
"an",
"encoded",
"symbol",
"string",
"."
] | 1ffb6021485b666ea6a562abd0a1ea6f7021188f | https://github.com/jbittel/base32-crockford/blob/1ffb6021485b666ea6a562abd0a1ea6f7021188f/base32_crockford.py#L133-L172 |
44,635 | has2k1/scikit-misc | setup.py | setup_requires | def setup_requires():
"""
Return required packages
Plus any version tests and warnings
"""
from pkg_resources import parse_version
required = ['cython>=0.24.0']
numpy_requirement = 'numpy>=1.7.1'
try:
import numpy
except Exception:
required.append(numpy_requirement)... | python | def setup_requires():
"""
Return required packages
Plus any version tests and warnings
"""
from pkg_resources import parse_version
required = ['cython>=0.24.0']
numpy_requirement = 'numpy>=1.7.1'
try:
import numpy
except Exception:
required.append(numpy_requirement)... | [
"def",
"setup_requires",
"(",
")",
":",
"from",
"pkg_resources",
"import",
"parse_version",
"required",
"=",
"[",
"'cython>=0.24.0'",
"]",
"numpy_requirement",
"=",
"'numpy>=1.7.1'",
"try",
":",
"import",
"numpy",
"except",
"Exception",
":",
"required",
".",
"appe... | Return required packages
Plus any version tests and warnings | [
"Return",
"required",
"packages"
] | 1d599761e11f84233e59602330e22823efeee226 | https://github.com/has2k1/scikit-misc/blob/1d599761e11f84233e59602330e22823efeee226/setup.py#L102-L120 |
44,636 | clokep/django-render-block | render_block/django.py | _build_block_context | def _build_block_context(template, context):
"""Populate the block context with BlockNodes from parent templates."""
# Ensure there's a BlockContext before rendering. This allows blocks in
# ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
# overriding sub-blocks to work).
... | python | def _build_block_context(template, context):
"""Populate the block context with BlockNodes from parent templates."""
# Ensure there's a BlockContext before rendering. This allows blocks in
# ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and
# overriding sub-blocks to work).
... | [
"def",
"_build_block_context",
"(",
"template",
",",
"context",
")",
":",
"# Ensure there's a BlockContext before rendering. This allows blocks in",
"# ExtendsNodes to be found by sub-templates (allowing {{ block.super }} and",
"# overriding sub-blocks to work).",
"if",
"BLOCK_CONTEXT_KEY",
... | Populate the block context with BlockNodes from parent templates. | [
"Populate",
"the",
"block",
"context",
"with",
"BlockNodes",
"from",
"parent",
"templates",
"."
] | 0c530c1bff76916afdbb6d409d55cd259ffe1962 | https://github.com/clokep/django-render-block/blob/0c530c1bff76916afdbb6d409d55cd259ffe1962/render_block/django.py#L40-L65 |
44,637 | clokep/django-render-block | render_block/django.py | _render_template_block_nodelist | def _render_template_block_nodelist(nodelist, block_name, context):
"""Recursively iterate over a node to find the wanted block."""
# Attempt to find the wanted block in the current template.
for node in nodelist:
# If the wanted block was found, return it.
if isinstance(node, BlockNode):
... | python | def _render_template_block_nodelist(nodelist, block_name, context):
"""Recursively iterate over a node to find the wanted block."""
# Attempt to find the wanted block in the current template.
for node in nodelist:
# If the wanted block was found, return it.
if isinstance(node, BlockNode):
... | [
"def",
"_render_template_block_nodelist",
"(",
"nodelist",
",",
"block_name",
",",
"context",
")",
":",
"# Attempt to find the wanted block in the current template.",
"for",
"node",
"in",
"nodelist",
":",
"# If the wanted block was found, return it.",
"if",
"isinstance",
"(",
... | Recursively iterate over a node to find the wanted block. | [
"Recursively",
"iterate",
"over",
"a",
"node",
"to",
"find",
"the",
"wanted",
"block",
"."
] | 0c530c1bff76916afdbb6d409d55cd259ffe1962 | https://github.com/clokep/django-render-block/blob/0c530c1bff76916afdbb6d409d55cd259ffe1962/render_block/django.py#L73-L102 |
44,638 | clokep/django-render-block | render_block/base.py | render_block_to_string | def render_block_to_string(template_name, block_name, context=None):
"""
Loads the given template_name and renders the given block with the given
dictionary as context. Returns a string.
template_name
The name of the template to load and render. If it's a list of
template na... | python | def render_block_to_string(template_name, block_name, context=None):
"""
Loads the given template_name and renders the given block with the given
dictionary as context. Returns a string.
template_name
The name of the template to load and render. If it's a list of
template na... | [
"def",
"render_block_to_string",
"(",
"template_name",
",",
"block_name",
",",
"context",
"=",
"None",
")",
":",
"# Like render_to_string, template_name can be a string or a list/tuple.",
"if",
"isinstance",
"(",
"template_name",
",",
"(",
"tuple",
",",
"list",
")",
")"... | Loads the given template_name and renders the given block with the given
dictionary as context. Returns a string.
template_name
The name of the template to load and render. If it's a list of
template names, Django uses select_template() instead of
get_template() to find ... | [
"Loads",
"the",
"given",
"template_name",
"and",
"renders",
"the",
"given",
"block",
"with",
"the",
"given",
"dictionary",
"as",
"context",
".",
"Returns",
"a",
"string",
"."
] | 0c530c1bff76916afdbb6d409d55cd259ffe1962 | https://github.com/clokep/django-render-block/blob/0c530c1bff76916afdbb6d409d55cd259ffe1962/render_block/base.py#L17-L47 |
44,639 | merll/docker-map | dockermap/map/config/host_volume.py | get_host_path | def get_host_path(root, path, instance=None):
"""
Generates the host path for a container volume. If the given path is a dictionary, uses the entry of the instance
name.
:param root: Root path to prepend, if ``path`` does not already describe an absolute path.
:type root: unicode | str | AbstractLa... | python | def get_host_path(root, path, instance=None):
"""
Generates the host path for a container volume. If the given path is a dictionary, uses the entry of the instance
name.
:param root: Root path to prepend, if ``path`` does not already describe an absolute path.
:type root: unicode | str | AbstractLa... | [
"def",
"get_host_path",
"(",
"root",
",",
"path",
",",
"instance",
"=",
"None",
")",
":",
"r_val",
"=",
"resolve_value",
"(",
"path",
")",
"if",
"isinstance",
"(",
"r_val",
",",
"dict",
")",
":",
"r_instance",
"=",
"instance",
"or",
"'default'",
"r_path"... | Generates the host path for a container volume. If the given path is a dictionary, uses the entry of the instance
name.
:param root: Root path to prepend, if ``path`` does not already describe an absolute path.
:type root: unicode | str | AbstractLazyObject
:param path: Path string or dictionary of per... | [
"Generates",
"the",
"host",
"path",
"for",
"a",
"container",
"volume",
".",
"If",
"the",
"given",
"path",
"is",
"a",
"dictionary",
"uses",
"the",
"entry",
"of",
"the",
"instance",
"name",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/host_volume.py#L11-L36 |
44,640 | merll/docker-map | dockermap/map/runner/__init__.py | AbstractRunner.run_actions | def run_actions(self, actions):
"""
Runs the given lists of attached actions and instance actions on the client.
:param actions: Actions to apply.
:type actions: list[dockermap.map.action.ItemAction]
:return: Where the result is not ``None``, returns the output from the client. ... | python | def run_actions(self, actions):
"""
Runs the given lists of attached actions and instance actions on the client.
:param actions: Actions to apply.
:type actions: list[dockermap.map.action.ItemAction]
:return: Where the result is not ``None``, returns the output from the client. ... | [
"def",
"run_actions",
"(",
"self",
",",
"actions",
")",
":",
"policy",
"=",
"self",
".",
"_policy",
"for",
"action",
"in",
"actions",
":",
"config_id",
"=",
"action",
".",
"config_id",
"config_type",
"=",
"config_id",
".",
"config_type",
"client_config",
"="... | Runs the given lists of attached actions and instance actions on the client.
:param actions: Actions to apply.
:type actions: list[dockermap.map.action.ItemAction]
:return: Where the result is not ``None``, returns the output from the client. Note that this is a generator
and needs to... | [
"Runs",
"the",
"given",
"lists",
"of",
"attached",
"actions",
"and",
"instance",
"actions",
"on",
"the",
"client",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/__init__.py#L39-L89 |
44,641 | merll/docker-map | dockermap/map/config/client.py | ClientConfiguration.from_client | def from_client(cls, client):
"""
Constructs a configuration object from an existing client instance. If the client has already been created with
a configuration object, returns that instance.
:param client: Client object to derive the configuration from.
:type client: docker.cl... | python | def from_client(cls, client):
"""
Constructs a configuration object from an existing client instance. If the client has already been created with
a configuration object, returns that instance.
:param client: Client object to derive the configuration from.
:type client: docker.cl... | [
"def",
"from_client",
"(",
"cls",
",",
"client",
")",
":",
"if",
"hasattr",
"(",
"client",
",",
"'client_configuration'",
")",
":",
"return",
"client",
".",
"client_configuration",
"kwargs",
"=",
"{",
"'client'",
":",
"client",
"}",
"for",
"attr",
"in",
"c... | Constructs a configuration object from an existing client instance. If the client has already been created with
a configuration object, returns that instance.
:param client: Client object to derive the configuration from.
:type client: docker.client.Client
:return: ClientConfiguration | [
"Constructs",
"a",
"configuration",
"object",
"from",
"an",
"existing",
"client",
"instance",
".",
"If",
"the",
"client",
"has",
"already",
"been",
"created",
"with",
"a",
"configuration",
"object",
"returns",
"that",
"instance",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/client.py#L58-L75 |
44,642 | merll/docker-map | dockermap/map/config/client.py | ClientConfiguration.get_init_kwargs | def get_init_kwargs(self):
"""
Generates keyword arguments for creating a new Docker client instance.
:return: Keyword arguments as defined through this configuration.
:rtype: dict
"""
init_kwargs = {}
for k in self.init_kwargs:
if k in self.core_prop... | python | def get_init_kwargs(self):
"""
Generates keyword arguments for creating a new Docker client instance.
:return: Keyword arguments as defined through this configuration.
:rtype: dict
"""
init_kwargs = {}
for k in self.init_kwargs:
if k in self.core_prop... | [
"def",
"get_init_kwargs",
"(",
"self",
")",
":",
"init_kwargs",
"=",
"{",
"}",
"for",
"k",
"in",
"self",
".",
"init_kwargs",
":",
"if",
"k",
"in",
"self",
".",
"core_property_set",
":",
"init_kwargs",
"[",
"k",
"]",
"=",
"getattr",
"(",
"self",
",",
... | Generates keyword arguments for creating a new Docker client instance.
:return: Keyword arguments as defined through this configuration.
:rtype: dict | [
"Generates",
"keyword",
"arguments",
"for",
"creating",
"a",
"new",
"Docker",
"client",
"instance",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/client.py#L89-L102 |
44,643 | merll/docker-map | dockermap/map/config/client.py | ClientConfiguration.get_client | def get_client(self):
"""
Retrieves or creates a client instance from this configuration object. If instantiated from this configuration,
the resulting object is also cached in the property ``client`` and a reference to this configuration is stored
on the client object.
:return:... | python | def get_client(self):
"""
Retrieves or creates a client instance from this configuration object. If instantiated from this configuration,
the resulting object is also cached in the property ``client`` and a reference to this configuration is stored
on the client object.
:return:... | [
"def",
"get_client",
"(",
"self",
")",
":",
"client",
"=",
"self",
".",
"_client",
"if",
"not",
"client",
":",
"self",
".",
"_client",
"=",
"client",
"=",
"self",
".",
"client_constructor",
"(",
"*",
"*",
"self",
".",
"get_init_kwargs",
"(",
")",
")",
... | Retrieves or creates a client instance from this configuration object. If instantiated from this configuration,
the resulting object is also cached in the property ``client`` and a reference to this configuration is stored
on the client object.
:return: Client object instance.
:rtype: d... | [
"Retrieves",
"or",
"creates",
"a",
"client",
"instance",
"from",
"this",
"configuration",
"object",
".",
"If",
"instantiated",
"from",
"this",
"configuration",
"the",
"resulting",
"object",
"is",
"also",
"cached",
"in",
"the",
"property",
"client",
"and",
"a",
... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/client.py#L104-L121 |
44,644 | merll/docker-map | dockermap/map/runner/cmd.py | ExecMixin.exec_commands | def exec_commands(self, action, c_name, run_cmds, **kwargs):
"""
Runs a single command inside a container.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:type c_name: unicode | str
:param run_c... | python | def exec_commands(self, action, c_name, run_cmds, **kwargs):
"""
Runs a single command inside a container.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:type c_name: unicode | str
:param run_c... | [
"def",
"exec_commands",
"(",
"self",
",",
"action",
",",
"c_name",
",",
"run_cmds",
",",
"*",
"*",
"kwargs",
")",
":",
"client",
"=",
"action",
".",
"client",
"exec_results",
"=",
"[",
"]",
"for",
"run_cmd",
"in",
"run_cmds",
":",
"cmd",
"=",
"run_cmd"... | Runs a single command inside a container.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:type c_name: unicode | str
:param run_cmds: Commands to run.
:type run_cmds: list[dockermap.map.input.ExecComman... | [
"Runs",
"a",
"single",
"command",
"inside",
"a",
"container",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/cmd.py#L21-L53 |
44,645 | merll/docker-map | dockermap/map/runner/cmd.py | ExecMixin.exec_container_commands | def exec_container_commands(self, action, c_name, **kwargs):
"""
Runs all configured commands of a container configuration inside the container instance.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:... | python | def exec_container_commands(self, action, c_name, **kwargs):
"""
Runs all configured commands of a container configuration inside the container instance.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:... | [
"def",
"exec_container_commands",
"(",
"self",
",",
"action",
",",
"c_name",
",",
"*",
"*",
"kwargs",
")",
":",
"config_cmds",
"=",
"action",
".",
"config",
".",
"exec_commands",
"if",
"not",
"config_cmds",
":",
"return",
"None",
"return",
"self",
".",
"ex... | Runs all configured commands of a container configuration inside the container instance.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param c_name: Container name.
:type c_name: unicode | str
:return: List of exec command return values (e... | [
"Runs",
"all",
"configured",
"commands",
"of",
"a",
"container",
"configuration",
"inside",
"the",
"container",
"instance",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/cmd.py#L55-L70 |
44,646 | merll/docker-map | dockermap/build/dockerfile.py | prepare_path | def prepare_path(path, replace_space, replace_sep, expandvars, expanduser):
"""
Performs `os.path` replacement operations on a path string.
:param path: Path string
:type path: unicode | str
:param replace_space: Mask spaces with backslash.
:param replace_sep: Replace potentially different path... | python | def prepare_path(path, replace_space, replace_sep, expandvars, expanduser):
"""
Performs `os.path` replacement operations on a path string.
:param path: Path string
:type path: unicode | str
:param replace_space: Mask spaces with backslash.
:param replace_sep: Replace potentially different path... | [
"def",
"prepare_path",
"(",
"path",
",",
"replace_space",
",",
"replace_sep",
",",
"expandvars",
",",
"expanduser",
")",
":",
"r_path",
"=",
"path",
"if",
"expandvars",
":",
"r_path",
"=",
"os",
".",
"path",
".",
"expandvars",
"(",
"r_path",
")",
"if",
"... | Performs `os.path` replacement operations on a path string.
:param path: Path string
:type path: unicode | str
:param replace_space: Mask spaces with backslash.
:param replace_sep: Replace potentially different path separators with POSIX path notation (use :const:`posixpath.sep`).
:type replace_sep... | [
"Performs",
"os",
".",
"path",
"replacement",
"operations",
"on",
"a",
"path",
"string",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/dockerfile.py#L16-L41 |
44,647 | merll/docker-map | dockermap/build/dockerfile.py | format_command | def format_command(cmd, shell=False):
"""
Converts a command line to the notation as used in a Dockerfile ``CMD`` and ``ENTRYPOINT`` command. In shell
notation, this returns a simple string, whereas by default it returns a JSON-list format with the command and
arguments.
:param cmd: Command line as... | python | def format_command(cmd, shell=False):
"""
Converts a command line to the notation as used in a Dockerfile ``CMD`` and ``ENTRYPOINT`` command. In shell
notation, this returns a simple string, whereas by default it returns a JSON-list format with the command and
arguments.
:param cmd: Command line as... | [
"def",
"format_command",
"(",
"cmd",
",",
"shell",
"=",
"False",
")",
":",
"def",
"_split_cmd",
"(",
")",
":",
"line",
"=",
"None",
"for",
"part",
"in",
"cmd",
".",
"split",
"(",
"' '",
")",
":",
"line",
"=",
"part",
"if",
"line",
"is",
"None",
"... | Converts a command line to the notation as used in a Dockerfile ``CMD`` and ``ENTRYPOINT`` command. In shell
notation, this returns a simple string, whereas by default it returns a JSON-list format with the command and
arguments.
:param cmd: Command line as a string or tuple.
:type cmd: unicode | str |... | [
"Converts",
"a",
"command",
"line",
"to",
"the",
"notation",
"as",
"used",
"in",
"a",
"Dockerfile",
"CMD",
"and",
"ENTRYPOINT",
"command",
".",
"In",
"shell",
"notation",
"this",
"returns",
"a",
"simple",
"string",
"whereas",
"by",
"default",
"it",
"returns"... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/dockerfile.py#L44-L80 |
44,648 | merll/docker-map | dockermap/build/dockerfile.py | format_expose | def format_expose(expose):
"""
Converts a port number or multiple port numbers, as used in the Dockerfile ``EXPOSE`` command, to a tuple.
:param: Port numbers, can be as integer, string, or a list/tuple of those.
:type expose: int | unicode | str | list | tuple
:return: A tuple, to be separated by ... | python | def format_expose(expose):
"""
Converts a port number or multiple port numbers, as used in the Dockerfile ``EXPOSE`` command, to a tuple.
:param: Port numbers, can be as integer, string, or a list/tuple of those.
:type expose: int | unicode | str | list | tuple
:return: A tuple, to be separated by ... | [
"def",
"format_expose",
"(",
"expose",
")",
":",
"if",
"isinstance",
"(",
"expose",
",",
"six",
".",
"string_types",
")",
":",
"return",
"expose",
",",
"elif",
"isinstance",
"(",
"expose",
",",
"collections",
".",
"Iterable",
")",
":",
"return",
"map",
"... | Converts a port number or multiple port numbers, as used in the Dockerfile ``EXPOSE`` command, to a tuple.
:param: Port numbers, can be as integer, string, or a list/tuple of those.
:type expose: int | unicode | str | list | tuple
:return: A tuple, to be separated by spaces before inserting in a Dockerfile... | [
"Converts",
"a",
"port",
"number",
"or",
"multiple",
"port",
"numbers",
"as",
"used",
"in",
"the",
"Dockerfile",
"EXPOSE",
"command",
"to",
"a",
"tuple",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/dockerfile.py#L83-L96 |
44,649 | merll/docker-map | dockermap/build/dockerfile.py | DockerFile.add_file | def add_file(self, src_path, dst_path=None, ctx_path=None, replace_space=True, expandvars=False, expanduser=False,
remove_final=False):
"""
Adds a file to the Docker build. An ``ADD`` command is inserted, and the path is stored for later packaging of
the context tarball.
... | python | def add_file(self, src_path, dst_path=None, ctx_path=None, replace_space=True, expandvars=False, expanduser=False,
remove_final=False):
"""
Adds a file to the Docker build. An ``ADD`` command is inserted, and the path is stored for later packaging of
the context tarball.
... | [
"def",
"add_file",
"(",
"self",
",",
"src_path",
",",
"dst_path",
"=",
"None",
",",
"ctx_path",
"=",
"None",
",",
"replace_space",
"=",
"True",
",",
"expandvars",
"=",
"False",
",",
"expanduser",
"=",
"False",
",",
"remove_final",
"=",
"False",
")",
":",... | Adds a file to the Docker build. An ``ADD`` command is inserted, and the path is stored for later packaging of
the context tarball.
:param src_path: Path to the file or directory.
:type src_path: unicode | str
:param dst_path: Destination path during the Docker build. By default uses th... | [
"Adds",
"a",
"file",
"to",
"the",
"Docker",
"build",
".",
"An",
"ADD",
"command",
"is",
"inserted",
"and",
"the",
"path",
"is",
"stored",
"for",
"later",
"packaging",
"of",
"the",
"context",
"tarball",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/dockerfile.py#L202-L249 |
44,650 | merll/docker-map | dockermap/build/dockerfile.py | DockerFile.write | def write(self, input_str):
"""
Adds content to the Dockerfile.
:param input_str: Content.
:type input_str: unicode | str
"""
self.check_not_finalized()
if isinstance(input_str, six.binary_type):
self.fileobj.write(input_str)
else:
... | python | def write(self, input_str):
"""
Adds content to the Dockerfile.
:param input_str: Content.
:type input_str: unicode | str
"""
self.check_not_finalized()
if isinstance(input_str, six.binary_type):
self.fileobj.write(input_str)
else:
... | [
"def",
"write",
"(",
"self",
",",
"input_str",
")",
":",
"self",
".",
"check_not_finalized",
"(",
")",
"if",
"isinstance",
"(",
"input_str",
",",
"six",
".",
"binary_type",
")",
":",
"self",
".",
"fileobj",
".",
"write",
"(",
"input_str",
")",
"else",
... | Adds content to the Dockerfile.
:param input_str: Content.
:type input_str: unicode | str | [
"Adds",
"content",
"to",
"the",
"Dockerfile",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/build/dockerfile.py#L307-L318 |
44,651 | merll/docker-map | dockermap/map/policy/dep.py | ContainerDependencyMergeMixin.merge_dependency | def merge_dependency(self, item, resolve_parent, parents):
"""
Merge dependencies of current configuration with further dependencies; in this instance, it means that in case
of container configuration first parent dependencies are checked, and then immediate dependencies of the current
c... | python | def merge_dependency(self, item, resolve_parent, parents):
"""
Merge dependencies of current configuration with further dependencies; in this instance, it means that in case
of container configuration first parent dependencies are checked, and then immediate dependencies of the current
c... | [
"def",
"merge_dependency",
"(",
"self",
",",
"item",
",",
"resolve_parent",
",",
"parents",
")",
":",
"dep",
"=",
"[",
"]",
"for",
"parent_key",
"in",
"parents",
":",
"if",
"item",
"==",
"parent_key",
":",
"raise",
"CircularDependency",
"(",
"item",
",",
... | Merge dependencies of current configuration with further dependencies; in this instance, it means that in case
of container configuration first parent dependencies are checked, and then immediate dependencies of the current
configuration should be added to the list, but without duplicating any entries.
... | [
"Merge",
"dependencies",
"of",
"current",
"configuration",
"with",
"further",
"dependencies",
";",
"in",
"this",
"instance",
"it",
"means",
"that",
"in",
"case",
"of",
"container",
"configuration",
"first",
"parent",
"dependencies",
"are",
"checked",
"and",
"then"... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/dep.py#L14-L39 |
44,652 | merll/docker-map | dockermap/map/yaml.py | load_map | def load_map(stream, name=None, check_integrity=True, check_duplicates=True):
"""
Loads a ContainerMap configuration from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param name: Name of the ContainerMap. If not provided, will be attempted to read from a ``name`` attribut... | python | def load_map(stream, name=None, check_integrity=True, check_duplicates=True):
"""
Loads a ContainerMap configuration from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param name: Name of the ContainerMap. If not provided, will be attempted to read from a ``name`` attribut... | [
"def",
"load_map",
"(",
"stream",
",",
"name",
"=",
"None",
",",
"check_integrity",
"=",
"True",
",",
"check_duplicates",
"=",
"True",
")",
":",
"map_dict",
"=",
"yaml",
".",
"safe_load",
"(",
"stream",
")",
"if",
"isinstance",
"(",
"map_dict",
",",
"dic... | Loads a ContainerMap configuration from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param name: Name of the ContainerMap. If not provided, will be attempted to read from a ``name`` attribute on the
document root level.
:type name: unicode | str
:param check_integri... | [
"Loads",
"a",
"ContainerMap",
"configuration",
"from",
"a",
"YAML",
"document",
"stream",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/yaml.py#L56-L78 |
44,653 | merll/docker-map | dockermap/map/yaml.py | load_clients | def load_clients(stream, configuration_class=ClientConfiguration):
"""
Loads client configurations from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
:return: A... | python | def load_clients(stream, configuration_class=ClientConfiguration):
"""
Loads client configurations from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
:return: A... | [
"def",
"load_clients",
"(",
"stream",
",",
"configuration_class",
"=",
"ClientConfiguration",
")",
":",
"client_dict",
"=",
"yaml",
".",
"safe_load",
"(",
"stream",
")",
"if",
"isinstance",
"(",
"client_dict",
",",
"dict",
")",
":",
"return",
"{",
"client_name... | Loads client configurations from a YAML document stream.
:param stream: YAML stream.
:type stream: file
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
:return: A dictionary of client configuration objects.
:rtype: dict[unicode | str, do... | [
"Loads",
"client",
"configurations",
"from",
"a",
"YAML",
"document",
"stream",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/yaml.py#L81-L96 |
44,654 | merll/docker-map | dockermap/map/yaml.py | load_map_file | def load_map_file(filename, name=None, check_integrity=True):
"""
Loads a ContainerMap configuration from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param name: Name of the ContainerMap. If ``None`` will attempt to find a ``name`` element on the root level of
... | python | def load_map_file(filename, name=None, check_integrity=True):
"""
Loads a ContainerMap configuration from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param name: Name of the ContainerMap. If ``None`` will attempt to find a ``name`` element on the root level of
... | [
"def",
"load_map_file",
"(",
"filename",
",",
"name",
"=",
"None",
",",
"check_integrity",
"=",
"True",
")",
":",
"if",
"name",
"==",
"''",
":",
"base_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"filename",
")",
"map_name",
",",
"__",
",",
"... | Loads a ContainerMap configuration from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param name: Name of the ContainerMap. If ``None`` will attempt to find a ``name`` element on the root level of
the document; an empty string names the map according to the file, withou... | [
"Loads",
"a",
"ContainerMap",
"configuration",
"from",
"a",
"YAML",
"file",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/yaml.py#L99-L119 |
44,655 | merll/docker-map | dockermap/map/yaml.py | load_clients_file | def load_clients_file(filename, configuration_class=ClientConfiguration):
"""
Loads client configurations from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
... | python | def load_clients_file(filename, configuration_class=ClientConfiguration):
"""
Loads client configurations from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
... | [
"def",
"load_clients_file",
"(",
"filename",
",",
"configuration_class",
"=",
"ClientConfiguration",
")",
":",
"with",
"open",
"(",
"filename",
",",
"'r'",
")",
"as",
"f",
":",
"return",
"load_clients",
"(",
"f",
",",
"configuration_class",
"=",
"configuration_c... | Loads client configurations from a YAML file.
:param filename: YAML file name.
:type filename: unicode | str
:param configuration_class: Class of the configuration object to create.
:type configuration_class: class
:return: A dictionary of client configuration objects.
:rtype: dict[unicode | st... | [
"Loads",
"client",
"configurations",
"from",
"a",
"YAML",
"file",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/yaml.py#L122-L134 |
44,656 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.get_state_generator | def get_state_generator(self, action_name, policy, kwargs):
"""
Returns the state generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type policy:... | python | def get_state_generator(self, action_name, policy, kwargs):
"""
Returns the state generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type policy:... | [
"def",
"get_state_generator",
"(",
"self",
",",
"action_name",
",",
"policy",
",",
"kwargs",
")",
":",
"state_generator_cls",
"=",
"self",
".",
"generators",
"[",
"action_name",
"]",
"[",
"0",
"]",
"state_generator",
"=",
"state_generator_cls",
"(",
"policy",
... | Returns the state generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type policy: dockermap.map.policy.base.BasePolicy
:param kwargs: Keyword arguments. ... | [
"Returns",
"the",
"state",
"generator",
"to",
"be",
"used",
"for",
"the",
"given",
"action",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L112-L127 |
44,657 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.get_action_generator | def get_action_generator(self, action_name, policy, kwargs):
"""
Returns the action generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type polic... | python | def get_action_generator(self, action_name, policy, kwargs):
"""
Returns the action generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type polic... | [
"def",
"get_action_generator",
"(",
"self",
",",
"action_name",
",",
"policy",
",",
"kwargs",
")",
":",
"action_generator_cls",
"=",
"self",
".",
"generators",
"[",
"action_name",
"]",
"[",
"1",
"]",
"action_generator",
"=",
"action_generator_cls",
"(",
"policy"... | Returns the action generator to be used for the given action.
:param action_name: Action identifier name.
:type action_name: unicode | str
:param policy: An instance of the current policy class.
:type policy: dockermap.map.policy.base.BasePolicy
:param kwargs: Keyword arguments.... | [
"Returns",
"the",
"action",
"generator",
"to",
"be",
"used",
"for",
"the",
"given",
"action",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L129-L144 |
44,658 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.get_states | def get_states(self, action_name, config_name, instances=None, map_name=None, **kwargs):
"""
Returns a generator of states in relation to the indicated action.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container configuratio... | python | def get_states(self, action_name, config_name, instances=None, map_name=None, **kwargs):
"""
Returns a generator of states in relation to the indicated action.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container configuratio... | [
"def",
"get_states",
"(",
"self",
",",
"action_name",
",",
"config_name",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"policy",
"=",
"self",
".",
"get_policy",
"(",
")",
"_set_forced_update_ids",
"(",
"... | Returns a generator of states in relation to the indicated action.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container configuration(s) or MapConfigId tuple(s).
:type config_name: unicode | str | collections.Iterable[unicode | str] ... | [
"Returns",
"a",
"generator",
"of",
"states",
"in",
"relation",
"to",
"the",
"indicated",
"action",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L159-L181 |
44,659 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.get_actions | def get_actions(self, action_name, config_name, instances=None, map_name=None, **kwargs):
"""
Returns the entire set of actions performed for the indicated action name.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container con... | python | def get_actions(self, action_name, config_name, instances=None, map_name=None, **kwargs):
"""
Returns the entire set of actions performed for the indicated action name.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container con... | [
"def",
"get_actions",
"(",
"self",
",",
"action_name",
",",
"config_name",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"policy",
"=",
"self",
".",
"get_policy",
"(",
")",
"action_generator",
"=",
"self"... | Returns the entire set of actions performed for the indicated action name.
:param action_name: Action name.
:type action_name: unicode | str
:param config_name: Name(s) of container configuration(s) or MapConfigId tuple(s).
:type config_name: unicode | str | collections.Iterable[unicode... | [
"Returns",
"the",
"entire",
"set",
"of",
"actions",
"performed",
"for",
"the",
"indicated",
"action",
"name",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L183-L207 |
44,660 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.create | def create(self, container, instances=None, map_name=None, **kwargs):
"""
Creates container instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance name to create. If not specified, will create all inst... | python | def create(self, container, instances=None, map_name=None, **kwargs):
"""
Creates container instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance name to create. If not specified, will create all inst... | [
"def",
"create",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'create'",
",",
"container",
",",
"instances",
"=",
"instances",
... | Creates container instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance name to create. If not specified, will create all instances as specified in the
configuration (or just one default instance).
:... | [
"Creates",
"container",
"instances",
"for",
"a",
"container",
"configuration",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L240-L256 |
44,661 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.start | def start(self, container, instances=None, map_name=None, **kwargs):
"""
Starts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to start. If not specified, will start all instances as spec... | python | def start(self, container, instances=None, map_name=None, **kwargs):
"""
Starts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to start. If not specified, will start all instances as spec... | [
"def",
"start",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'start'",
",",
"container",
",",
"instances",
"=",
"instances",
"... | Starts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to start. If not specified, will start all instances as specified in the
configuration (or just one default instance).
:param map_na... | [
"Starts",
"instances",
"for",
"a",
"container",
"configuration",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L258-L274 |
44,662 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.restart | def restart(self, container, instances=None, map_name=None, **kwargs):
"""
Restarts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will restart all instances as... | python | def restart(self, container, instances=None, map_name=None, **kwargs):
"""
Restarts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will restart all instances as... | [
"def",
"restart",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'restart'",
",",
"container",
",",
"instances",
"=",
"instances",... | Restarts instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will restart all instances as specified in the
configuration (or just one default instance).
:type inst... | [
"Restarts",
"instances",
"for",
"a",
"container",
"configuration",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L276-L292 |
44,663 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.stop | def stop(self, container, instances=None, map_name=None, **kwargs):
"""
Stops instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will stop all instances as specifie... | python | def stop(self, container, instances=None, map_name=None, **kwargs):
"""
Stops instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will stop all instances as specifie... | [
"def",
"stop",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'stop'",
",",
"container",
",",
"instances",
"=",
"instances",
","... | Stops instances for a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to stop. If not specified, will stop all instances as specified in the
configuration (or just one default instance).
:type instances:... | [
"Stops",
"instances",
"for",
"a",
"container",
"configuration",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L294-L314 |
44,664 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.remove | def remove(self, container, instances=None, map_name=None, **kwargs):
"""
Remove instances from a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to remove. If not specified, will remove all instances as ... | python | def remove(self, container, instances=None, map_name=None, **kwargs):
"""
Remove instances from a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to remove. If not specified, will remove all instances as ... | [
"def",
"remove",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'remove'",
",",
"container",
",",
"instances",
"=",
"instances",
... | Remove instances from a container configuration.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to remove. If not specified, will remove all instances as specified in the
configuration (or just one default instance).
:type inst... | [
"Remove",
"instances",
"from",
"a",
"container",
"configuration",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L316-L332 |
44,665 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.startup | def startup(self, container, instances=None, map_name=None, **kwargs):
"""
Start up container instances from a container configuration. Typically this means creating and starting
containers and their dependencies. Note that not all policy classes necessarily implement this method.
:para... | python | def startup(self, container, instances=None, map_name=None, **kwargs):
"""
Start up container instances from a container configuration. Typically this means creating and starting
containers and their dependencies. Note that not all policy classes necessarily implement this method.
:para... | [
"def",
"startup",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'startup'",
",",
"container",
",",
"instances",
"=",
"instances",... | Start up container instances from a container configuration. Typically this means creating and starting
containers and their dependencies. Note that not all policy classes necessarily implement this method.
:param container: Container name.
:type container: unicode | str
:param instance... | [
"Start",
"up",
"container",
"instances",
"from",
"a",
"container",
"configuration",
".",
"Typically",
"this",
"means",
"creating",
"and",
"starting",
"containers",
"and",
"their",
"dependencies",
".",
"Note",
"that",
"not",
"all",
"policy",
"classes",
"necessarily... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L334-L350 |
44,666 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.shutdown | def shutdown(self, container, instances=None, map_name=None, **kwargs):
"""
Shut down container instances from a container configuration. Typically this means stopping and removing
containers. Note that not all policy classes necessarily implement this method.
:param container: Containe... | python | def shutdown(self, container, instances=None, map_name=None, **kwargs):
"""
Shut down container instances from a container configuration. Typically this means stopping and removing
containers. Note that not all policy classes necessarily implement this method.
:param container: Containe... | [
"def",
"shutdown",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'shutdown'",
",",
"container",
",",
"instances",
"=",
"instances... | Shut down container instances from a container configuration. Typically this means stopping and removing
containers. Note that not all policy classes necessarily implement this method.
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to r... | [
"Shut",
"down",
"container",
"instances",
"from",
"a",
"container",
"configuration",
".",
"Typically",
"this",
"means",
"stopping",
"and",
"removing",
"containers",
".",
"Note",
"that",
"not",
"all",
"policy",
"classes",
"necessarily",
"implement",
"this",
"method... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L352-L368 |
44,667 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.update | def update(self, container, instances=None, map_name=None, **kwargs):
"""
Updates instances from a container configuration. Typically this means restarting or recreating containers based
on detected changes in the configuration or environment. Note that not all policy classes necessarily implem... | python | def update(self, container, instances=None, map_name=None, **kwargs):
"""
Updates instances from a container configuration. Typically this means restarting or recreating containers based
on detected changes in the configuration or environment. Note that not all policy classes necessarily implem... | [
"def",
"update",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'update'",
",",
"container",
",",
"instances",
"=",
"instances",
... | Updates instances from a container configuration. Typically this means restarting or recreating containers based
on detected changes in the configuration or environment. Note that not all policy classes necessarily implement
this method.
:param container: Container name.
:type containe... | [
"Updates",
"instances",
"from",
"a",
"container",
"configuration",
".",
"Typically",
"this",
"means",
"restarting",
"or",
"recreating",
"containers",
"based",
"on",
"detected",
"changes",
"in",
"the",
"configuration",
"or",
"environment",
".",
"Note",
"that",
"not... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L370-L387 |
44,668 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.call | def call(self, action_name, container, instances=None, map_name=None, **kwargs):
"""
Generic function for running container actions based on a policy.
:param action_name: Action name.
:type action_name: unicode | str
:param container: Container name.
:type container: uni... | python | def call(self, action_name, container, instances=None, map_name=None, **kwargs):
"""
Generic function for running container actions based on a policy.
:param action_name: Action name.
:type action_name: unicode | str
:param container: Container name.
:type container: uni... | [
"def",
"call",
"(",
"self",
",",
"action_name",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"action_name",
",",
"container",
",",
"instances"... | Generic function for running container actions based on a policy.
:param action_name: Action name.
:type action_name: unicode | str
:param container: Container name.
:type container: unicode | str
:param instances: Instance names to remove. If not specified, runs on all instance... | [
"Generic",
"function",
"for",
"running",
"container",
"actions",
"based",
"on",
"a",
"policy",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L389-L406 |
44,669 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.pull_images | def pull_images(self, container, instances=None, map_name=None, **kwargs):
"""
Pulls images for container configurations along their dependency path.
:param container: Container configuration name.
:type container: unicode | str
:param map_name: Container map name.
:type... | python | def pull_images(self, container, instances=None, map_name=None, **kwargs):
"""
Pulls images for container configurations along their dependency path.
:param container: Container configuration name.
:type container: unicode | str
:param map_name: Container map name.
:type... | [
"def",
"pull_images",
"(",
"self",
",",
"container",
",",
"instances",
"=",
"None",
",",
"map_name",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"run_actions",
"(",
"'pull_images'",
",",
"container",
",",
"map_name",
"=",
"map_... | Pulls images for container configurations along their dependency path.
:param container: Container configuration name.
:type container: unicode | str
:param map_name: Container map name.
:type map_name: unicode | str
:param instances: Not applicable for images.
:type ins... | [
"Pulls",
"images",
"for",
"container",
"configurations",
"along",
"their",
"dependency",
"path",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L446-L460 |
44,670 | merll/docker-map | dockermap/map/client.py | MappingDockerClient.list_persistent_containers | def list_persistent_containers(self, map_name=None):
"""
Lists the names of all persistent containers on the specified map or all maps. Attached containers are always
considered persistent.
:param map_name: Container map name. Optional, only returns persistent containers from the specif... | python | def list_persistent_containers(self, map_name=None):
"""
Lists the names of all persistent containers on the specified map or all maps. Attached containers are always
considered persistent.
:param map_name: Container map name. Optional, only returns persistent containers from the specif... | [
"def",
"list_persistent_containers",
"(",
"self",
",",
"map_name",
"=",
"None",
")",
":",
"if",
"map_name",
":",
"maps",
"=",
"[",
"self",
".",
"_maps",
"[",
"map_name",
"]",
".",
"get_extended_map",
"(",
")",
"]",
"else",
":",
"maps",
"=",
"[",
"m",
... | Lists the names of all persistent containers on the specified map or all maps. Attached containers are always
considered persistent.
:param map_name: Container map name. Optional, only returns persistent containers from the specified map.
:type map_name: unicode | str
:return: List of c... | [
"Lists",
"the",
"names",
"of",
"all",
"persistent",
"containers",
"on",
"the",
"specified",
"map",
"or",
"all",
"maps",
".",
"Attached",
"containers",
"are",
"always",
"considered",
"persistent",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/client.py#L468-L496 |
44,671 | ThiefMaster/maildump | maildump/util.py | rest | def rest(f):
"""Decorator for simple REST endpoints.
Functions must return one of these values:
- a dict to jsonify
- nothing for an empty 204 response
- a tuple containing a status code and a dict to jsonify
"""
@wraps(f)
def wrapper(*args, **kwargs):
ret = f(*args, **kwargs)
... | python | def rest(f):
"""Decorator for simple REST endpoints.
Functions must return one of these values:
- a dict to jsonify
- nothing for an empty 204 response
- a tuple containing a status code and a dict to jsonify
"""
@wraps(f)
def wrapper(*args, **kwargs):
ret = f(*args, **kwargs)
... | [
"def",
"rest",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"ret",
"=",
"f",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
"if",
"ret",
"is",
"None",
":",
"respons... | Decorator for simple REST endpoints.
Functions must return one of these values:
- a dict to jsonify
- nothing for an empty 204 response
- a tuple containing a status code and a dict to jsonify | [
"Decorator",
"for",
"simple",
"REST",
"endpoints",
"."
] | 6425d44504ed28a9c927421f831ffa5da4cf2ae3 | https://github.com/ThiefMaster/maildump/blob/6425d44504ed28a9c927421f831ffa5da4cf2ae3/maildump/util.py#L40-L67 |
44,672 | merll/docker-map | dockermap/map/runner/image.py | ImageMixin.login | def login(self, action, registry, **kwargs):
"""
Logs in to a Docker registry.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param registry: Name of the registry server to login to.
:type registry: unicode | str
:param kwar... | python | def login(self, action, registry, **kwargs):
"""
Logs in to a Docker registry.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param registry: Name of the registry server to login to.
:type registry: unicode | str
:param kwar... | [
"def",
"login",
"(",
"self",
",",
"action",
",",
"registry",
",",
"*",
"*",
"kwargs",
")",
":",
"log",
".",
"info",
"(",
"\"Logging into registry %s.\"",
",",
"registry",
")",
"login_kwargs",
"=",
"{",
"'registry'",
":",
"registry",
"}",
"auth_config",
"="... | Logs in to a Docker registry.
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param registry: Name of the registry server to login to.
:type registry: unicode | str
:param kwargs: Additional keyword arguments to complement or override the co... | [
"Logs",
"in",
"to",
"a",
"Docker",
"registry",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/image.py#L22-L49 |
44,673 | merll/docker-map | dockermap/map/runner/image.py | ImageMixin.pull | def pull(self, action, image_name, **kwargs):
"""
Pulls an image for a container configuration
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param image_name: Image name.
:type image_name: unicode | str
:param kwargs: Addit... | python | def pull(self, action, image_name, **kwargs):
"""
Pulls an image for a container configuration
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param image_name: Image name.
:type image_name: unicode | str
:param kwargs: Addit... | [
"def",
"pull",
"(",
"self",
",",
"action",
",",
"image_name",
",",
"*",
"*",
"kwargs",
")",
":",
"config_id",
"=",
"action",
".",
"config_id",
"registry",
",",
"__",
",",
"image",
"=",
"config_id",
".",
"config_name",
".",
"rpartition",
"(",
"'/'",
")"... | Pulls an image for a container configuration
:param action: Action configuration.
:type action: dockermap.map.runner.ActionConfig
:param image_name: Image name.
:type image_name: unicode | str
:param kwargs: Additional keyword arguments to complement or override the configuratio... | [
"Pulls",
"an",
"image",
"for",
"a",
"container",
"configuration"
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/runner/image.py#L51-L71 |
44,674 | merll/docker-map | dockermap/client/cli.py | parse_networks_output | def parse_networks_output(out):
"""
Parses the output of the Docker CLI 'docker network ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict]
"""
if not out:
return []
line_iter... | python | def parse_networks_output(out):
"""
Parses the output of the Docker CLI 'docker network ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict]
"""
if not out:
return []
line_iter... | [
"def",
"parse_networks_output",
"(",
"out",
")",
":",
"if",
"not",
"out",
":",
"return",
"[",
"]",
"line_iter",
"=",
"islice",
"(",
"out",
".",
"splitlines",
"(",
")",
",",
"1",
",",
"None",
")",
"# Skip header",
"return",
"list",
"(",
"map",
"(",
"_... | Parses the output of the Docker CLI 'docker network ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict] | [
"Parses",
"the",
"output",
"of",
"the",
"Docker",
"CLI",
"docker",
"network",
"ls",
"and",
"returns",
"it",
"in",
"the",
"format",
"similar",
"to",
"the",
"Docker",
"API",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/cli.py#L243-L255 |
44,675 | merll/docker-map | dockermap/client/cli.py | parse_volumes_output | def parse_volumes_output(out):
"""
Parses the output of the Docker CLI 'docker volume ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict]
"""
if not out:
return []
line_iter =... | python | def parse_volumes_output(out):
"""
Parses the output of the Docker CLI 'docker volume ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict]
"""
if not out:
return []
line_iter =... | [
"def",
"parse_volumes_output",
"(",
"out",
")",
":",
"if",
"not",
"out",
":",
"return",
"[",
"]",
"line_iter",
"=",
"islice",
"(",
"out",
".",
"splitlines",
"(",
")",
",",
"1",
",",
"None",
")",
"# Skip header",
"return",
"list",
"(",
"map",
"(",
"_v... | Parses the output of the Docker CLI 'docker volume ls' and returns it in the format similar to the Docker API.
:param out: CLI output.
:type out: unicode | str
:return: Parsed result.
:rtype: list[dict] | [
"Parses",
"the",
"output",
"of",
"the",
"Docker",
"CLI",
"docker",
"volume",
"ls",
"and",
"returns",
"it",
"in",
"the",
"format",
"similar",
"to",
"the",
"Docker",
"API",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/cli.py#L258-L270 |
44,676 | merll/docker-map | dockermap/client/cli.py | parse_images_output | def parse_images_output(out):
"""
Parses the output of the Docker CLI 'docker images'. Note this is currently incomplete and only returns the ids and
tags of images, as the Docker CLI heavily modifies the output for human readability. The parent image id is also
not available on the CLI, so a full API c... | python | def parse_images_output(out):
"""
Parses the output of the Docker CLI 'docker images'. Note this is currently incomplete and only returns the ids and
tags of images, as the Docker CLI heavily modifies the output for human readability. The parent image id is also
not available on the CLI, so a full API c... | [
"def",
"parse_images_output",
"(",
"out",
")",
":",
"line_iter",
"=",
"islice",
"(",
"out",
".",
"splitlines",
"(",
")",
",",
"1",
",",
"None",
")",
"# Skip header",
"split_lines",
"=",
"(",
"line",
".",
"split",
"(",
")",
"for",
"line",
"in",
"line_it... | Parses the output of the Docker CLI 'docker images'. Note this is currently incomplete and only returns the ids and
tags of images, as the Docker CLI heavily modifies the output for human readability. The parent image id is also
not available on the CLI, so a full API compatibility is not possible.
:param ... | [
"Parses",
"the",
"output",
"of",
"the",
"Docker",
"CLI",
"docker",
"images",
".",
"Note",
"this",
"is",
"currently",
"incomplete",
"and",
"only",
"returns",
"the",
"ids",
"and",
"tags",
"of",
"images",
"as",
"the",
"Docker",
"CLI",
"heavily",
"modifies",
"... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/cli.py#L291-L307 |
44,677 | merll/docker-map | dockermap/map/policy/cache.py | CachedImages.refresh | def refresh(self):
"""
Fetches image and their ids from the client.
"""
if not self._client:
return
current_images = self._client.images()
self.clear()
self._update(current_images)
for image in current_images:
tags = image.get('Repo... | python | def refresh(self):
"""
Fetches image and their ids from the client.
"""
if not self._client:
return
current_images = self._client.images()
self.clear()
self._update(current_images)
for image in current_images:
tags = image.get('Repo... | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_client",
":",
"return",
"current_images",
"=",
"self",
".",
"_client",
".",
"images",
"(",
")",
"self",
".",
"clear",
"(",
")",
"self",
".",
"_update",
"(",
"current_images",
")",
"... | Fetches image and their ids from the client. | [
"Fetches",
"image",
"and",
"their",
"ids",
"from",
"the",
"client",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/cache.py#L34-L46 |
44,678 | merll/docker-map | dockermap/map/policy/cache.py | CachedContainerNames.refresh | def refresh(self):
"""
Fetches all current container names from the client, along with their id.
"""
if not self._client:
return
current_containers = self._client.containers(all=True)
self.clear()
for container in current_containers:
contai... | python | def refresh(self):
"""
Fetches all current container names from the client, along with their id.
"""
if not self._client:
return
current_containers = self._client.containers(all=True)
self.clear()
for container in current_containers:
contai... | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_client",
":",
"return",
"current_containers",
"=",
"self",
".",
"_client",
".",
"containers",
"(",
"all",
"=",
"True",
")",
"self",
".",
"clear",
"(",
")",
"for",
"container",
"in",
... | Fetches all current container names from the client, along with their id. | [
"Fetches",
"all",
"current",
"container",
"names",
"from",
"the",
"client",
"along",
"with",
"their",
"id",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/cache.py#L55-L68 |
44,679 | merll/docker-map | dockermap/map/policy/cache.py | CachedNetworkNames.refresh | def refresh(self):
"""
Fetches all current network names from the client, along with their id.
"""
if not self._client:
return
current_networks = self._client.networks()
self.clear()
self.update((net['Name'], net['Id'])
for net in c... | python | def refresh(self):
"""
Fetches all current network names from the client, along with their id.
"""
if not self._client:
return
current_networks = self._client.networks()
self.clear()
self.update((net['Name'], net['Id'])
for net in c... | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_client",
":",
"return",
"current_networks",
"=",
"self",
".",
"_client",
".",
"networks",
"(",
")",
"self",
".",
"clear",
"(",
")",
"self",
".",
"update",
"(",
"(",
"net",
"[",
"'... | Fetches all current network names from the client, along with their id. | [
"Fetches",
"all",
"current",
"network",
"names",
"from",
"the",
"client",
"along",
"with",
"their",
"id",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/cache.py#L72-L81 |
44,680 | merll/docker-map | dockermap/map/policy/cache.py | CachedVolumeNames.refresh | def refresh(self):
"""
Fetches all current network names from the client.
"""
if not self._client:
return
current_volumes = self._client.volumes()['Volumes']
self.clear()
if current_volumes:
self.update(vol['Name'] for vol in current_volume... | python | def refresh(self):
"""
Fetches all current network names from the client.
"""
if not self._client:
return
current_volumes = self._client.volumes()['Volumes']
self.clear()
if current_volumes:
self.update(vol['Name'] for vol in current_volume... | [
"def",
"refresh",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"_client",
":",
"return",
"current_volumes",
"=",
"self",
".",
"_client",
".",
"volumes",
"(",
")",
"[",
"'Volumes'",
"]",
"self",
".",
"clear",
"(",
")",
"if",
"current_volumes",
":",
... | Fetches all current network names from the client. | [
"Fetches",
"all",
"current",
"network",
"names",
"from",
"the",
"client",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/cache.py#L85-L94 |
44,681 | merll/docker-map | dockermap/map/policy/cache.py | DockerHostItemCache.refresh | def refresh(self, item):
"""
Forces a refresh of a cached item.
:param item: Client name.
:type item: unicode | str
:return: Items in the cache.
:rtype: DockerHostItemCache.item_class
"""
client = self._clients[item].get_client()
self[item] = val ... | python | def refresh(self, item):
"""
Forces a refresh of a cached item.
:param item: Client name.
:type item: unicode | str
:return: Items in the cache.
:rtype: DockerHostItemCache.item_class
"""
client = self._clients[item].get_client()
self[item] = val ... | [
"def",
"refresh",
"(",
"self",
",",
"item",
")",
":",
"client",
"=",
"self",
".",
"_clients",
"[",
"item",
"]",
".",
"get_client",
"(",
")",
"self",
"[",
"item",
"]",
"=",
"val",
"=",
"self",
".",
"item_class",
"(",
"client",
")",
"return",
"val"
] | Forces a refresh of a cached item.
:param item: Client name.
:type item: unicode | str
:return: Items in the cache.
:rtype: DockerHostItemCache.item_class | [
"Forces",
"a",
"refresh",
"of",
"a",
"cached",
"item",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/policy/cache.py#L123-L134 |
44,682 | merll/docker-map | dockermap/map/config/main.py | ContainerMap.get_image | def get_image(self, image):
"""
Generates a tuple of the full image name and tag, that should be used when creating a new container.
This implementation applies the following rules:
* If the image name starts with ``/``, the following image name is returned.
* If ``/`` is found... | python | def get_image(self, image):
"""
Generates a tuple of the full image name and tag, that should be used when creating a new container.
This implementation applies the following rules:
* If the image name starts with ``/``, the following image name is returned.
* If ``/`` is found... | [
"def",
"get_image",
"(",
"self",
",",
"image",
")",
":",
"name",
",",
"__",
",",
"tag",
"=",
"image",
".",
"rpartition",
"(",
"':'",
")",
"if",
"not",
"name",
":",
"name",
",",
"tag",
"=",
"tag",
",",
"name",
"if",
"'/'",
"in",
"name",
":",
"if... | Generates a tuple of the full image name and tag, that should be used when creating a new container.
This implementation applies the following rules:
* If the image name starts with ``/``, the following image name is returned.
* If ``/`` is found anywhere else in the image name, it is assumed ... | [
"Generates",
"a",
"tuple",
"of",
"the",
"full",
"image",
"name",
"and",
"tag",
"that",
"should",
"be",
"used",
"when",
"creating",
"a",
"new",
"container",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/main.py#L293-L330 |
44,683 | merll/docker-map | dockermap/map/config/main.py | ContainerMap.get_extended | def get_extended(self, config):
"""
Generates a configuration that includes all inherited values.
:param config: Container configuration.
:type config: ContainerConfiguration
:return: A merged (shallow) copy of all inherited configurations merged with the container configuration... | python | def get_extended(self, config):
"""
Generates a configuration that includes all inherited values.
:param config: Container configuration.
:type config: ContainerConfiguration
:return: A merged (shallow) copy of all inherited configurations merged with the container configuration... | [
"def",
"get_extended",
"(",
"self",
",",
"config",
")",
":",
"if",
"not",
"config",
".",
"extends",
"or",
"self",
".",
"_extended",
":",
"return",
"config",
"extended_config",
"=",
"ContainerConfiguration",
"(",
")",
"for",
"ext_name",
"in",
"config",
".",
... | Generates a configuration that includes all inherited values.
:param config: Container configuration.
:type config: ContainerConfiguration
:return: A merged (shallow) copy of all inherited configurations merged with the container configuration.
:rtype: ContainerConfiguration | [
"Generates",
"a",
"configuration",
"that",
"includes",
"all",
"inherited",
"values",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/main.py#L502-L521 |
44,684 | merll/docker-map | dockermap/map/config/main.py | ContainerMap.get_extended_map | def get_extended_map(self):
"""
Creates a copy of this map which includes all non-abstract configurations in their extended form.
:return: Copy of this map.
:rtype: ContainerMap
"""
map_copy = self.__class__(self.name)
map_copy.update_from_obj(self, copy=True, up... | python | def get_extended_map(self):
"""
Creates a copy of this map which includes all non-abstract configurations in their extended form.
:return: Copy of this map.
:rtype: ContainerMap
"""
map_copy = self.__class__(self.name)
map_copy.update_from_obj(self, copy=True, up... | [
"def",
"get_extended_map",
"(",
"self",
")",
":",
"map_copy",
"=",
"self",
".",
"__class__",
"(",
"self",
".",
"name",
")",
"map_copy",
".",
"update_from_obj",
"(",
"self",
",",
"copy",
"=",
"True",
",",
"update_containers",
"=",
"False",
")",
"for",
"c_... | Creates a copy of this map which includes all non-abstract configurations in their extended form.
:return: Copy of this map.
:rtype: ContainerMap | [
"Creates",
"a",
"copy",
"of",
"this",
"map",
"which",
"includes",
"all",
"non",
"-",
"abstract",
"configurations",
"in",
"their",
"extended",
"form",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/config/main.py#L523-L535 |
44,685 | merll/docker-map | dockermap/map/action/simple.py | CreateActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Creates all missing containers, networks, and volumes.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and ... | python | def get_state_actions(self, state, **kwargs):
"""
Creates all missing containers, networks, and volumes.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and ... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"state",
".",
"base_state",
"==",
"State",
".",
"ABSENT",
":",
"if",
"state",
".",
"config_id",
".",
"config_type",
"==",
"ItemType",
".",
"IMAGE",
":",
"re... | Creates all missing containers, networks, and volumes.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configurations.
:rtype: list[dockermap.map.action.ItemActi... | [
"Creates",
"all",
"missing",
"containers",
"networks",
"and",
"volumes",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L11-L27 |
44,686 | merll/docker-map | dockermap/map/action/simple.py | StartActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Generally starts containers that are not running. Attached containers are skipped unless they are initial.
Attached containers are also prepared with permissions. Where applicable, exec commands are run in started
instance containers.
... | python | def get_state_actions(self, state, **kwargs):
"""
Generally starts containers that are not running. Attached containers are skipped unless they are initial.
Attached containers are also prepared with permissions. Where applicable, exec commands are run in started
instance containers.
... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"config_type",
"=",
"state",
".",
"config_id",
".",
"config_type",
"if",
"(",
"config_type",
"==",
"ItemType",
".",
"VOLUME",
"and",
"state",
".",
"base_state",
"==",... | Generally starts containers that are not running. Attached containers are skipped unless they are initial.
Attached containers are also prepared with permissions. Where applicable, exec commands are run in started
instance containers.
:param state: Configuration state.
:type state: dock... | [
"Generally",
"starts",
"containers",
"that",
"are",
"not",
"running",
".",
"Attached",
"containers",
"are",
"skipped",
"unless",
"they",
"are",
"initial",
".",
"Attached",
"containers",
"are",
"also",
"prepared",
"with",
"permissions",
".",
"Where",
"applicable",
... | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L31-L54 |
44,687 | merll/docker-map | dockermap/map/action/simple.py | RestartActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Restarts instance containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configurations.
:... | python | def get_state_actions(self, state, **kwargs):
"""
Restarts instance containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configurations.
:... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"state",
".",
"config_id",
".",
"config_type",
"==",
"ItemType",
".",
"CONTAINER",
"and",
"state",
".",
"base_state",
"!=",
"State",
".",
"ABSENT",
"and"... | Restarts instance containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configurations.
:rtype: list[dockermap.map.action.ItemAction] | [
"Restarts",
"instance",
"containers",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L61-L76 |
44,688 | merll/docker-map | dockermap/map/action/simple.py | StopActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Stops containers that are running. Does not check attached containers. Considers using the pre-configured
``stop_signal``.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Add... | python | def get_state_actions(self, state, **kwargs):
"""
Stops containers that are running. Does not check attached containers. Considers using the pre-configured
``stop_signal``.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Add... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"state",
".",
"config_id",
".",
"config_type",
"==",
"ItemType",
".",
"CONTAINER",
"and",
"state",
".",
"base_state",
"!=",
"State",
".",
"ABSENT",
"and"... | Stops containers that are running. Does not check attached containers. Considers using the pre-configured
``stop_signal``.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client,... | [
"Stops",
"containers",
"that",
"are",
"running",
".",
"Does",
"not",
"check",
"attached",
"containers",
".",
"Considers",
"using",
"the",
"pre",
"-",
"configured",
"stop_signal",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L80-L93 |
44,689 | merll/docker-map | dockermap/map/action/simple.py | RemoveActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Removes containers that are stopped. Optionally skips persistent containers. Attached containers are skipped
by default from removal but can optionally be included.
:param state: Configuration state.
:type state: dockermap.map.st... | python | def get_state_actions(self, state, **kwargs):
"""
Removes containers that are stopped. Optionally skips persistent containers. Attached containers are skipped
by default from removal but can optionally be included.
:param state: Configuration state.
:type state: dockermap.map.st... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"config_type",
"=",
"state",
".",
"config_id",
".",
"config_type",
"if",
"config_type",
"==",
"ItemType",
".",
"CONTAINER",
":",
"extra_data",
"=",
"kwargs",
"else",
... | Removes containers that are stopped. Optionally skips persistent containers. Attached containers are skipped
by default from removal but can optionally be included.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword argument... | [
"Removes",
"containers",
"that",
"are",
"stopped",
".",
"Optionally",
"skips",
"persistent",
"containers",
".",
"Attached",
"containers",
"are",
"skipped",
"by",
"default",
"from",
"removal",
"but",
"can",
"optionally",
"be",
"included",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L101-L129 |
44,690 | merll/docker-map | dockermap/map/action/simple.py | StartupActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
A combination of CreateActionGenerator and StartActionGenerator - creates and starts containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional ... | python | def get_state_actions(self, state, **kwargs):
"""
A combination of CreateActionGenerator and StartActionGenerator - creates and starts containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional ... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"config_type",
"=",
"state",
".",
"config_id",
".",
"config_type",
"if",
"config_type",
"==",
"ItemType",
".",
"VOLUME",
":",
"if",
"state",
".",
"base_state",
"==",
... | A combination of CreateActionGenerator and StartActionGenerator - creates and starts containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, an... | [
"A",
"combination",
"of",
"CreateActionGenerator",
"and",
"StartActionGenerator",
"-",
"creates",
"and",
"starts",
"containers",
"where",
"appropriate",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L133-L171 |
44,691 | merll/docker-map | dockermap/map/action/simple.py | ShutdownActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
A combination of StopActionGenerator and RemoveActionGenerator - stops and removes containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional ke... | python | def get_state_actions(self, state, **kwargs):
"""
A combination of StopActionGenerator and RemoveActionGenerator - stops and removes containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional ke... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"config_type",
"=",
"state",
".",
"config_id",
".",
"config_type",
"if",
"config_type",
"==",
"ItemType",
".",
"NETWORK",
":",
"if",
"state",
".",
"base_state",
"==",... | A combination of StopActionGenerator and RemoveActionGenerator - stops and removes containers where
appropriate.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and ... | [
"A",
"combination",
"of",
"StopActionGenerator",
"and",
"RemoveActionGenerator",
"-",
"stops",
"and",
"removes",
"containers",
"where",
"appropriate",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L175-L207 |
44,692 | merll/docker-map | dockermap/map/action/simple.py | SignalActionGenerator.get_state_actions | def get_state_actions(self, state, **kwargs):
"""
Sends kill signals to running containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configuration... | python | def get_state_actions(self, state, **kwargs):
"""
Sends kill signals to running containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configuration... | [
"def",
"get_state_actions",
"(",
"self",
",",
"state",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"state",
".",
"config_id",
".",
"config_type",
"==",
"ItemType",
".",
"CONTAINER",
"and",
"state",
".",
"base_state",
"==",
"State",
".",
"RUNNING",
":",
"ret... | Sends kill signals to running containers.
:param state: Configuration state.
:type state: dockermap.map.state.ConfigState
:param kwargs: Additional keyword arguments.
:return: Actions on the client, map, and configurations.
:rtype: list[dockermap.map.action.ItemAction] | [
"Sends",
"kill",
"signals",
"to",
"running",
"containers",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/map/action/simple.py#L211-L222 |
44,693 | clarete/curdling | curdling/services/installer.py | get_distribution_paths | def get_distribution_paths(name):
"""Return target paths where the package content should be installed"""
pyver = 'python' + sys.version[:3]
paths = {
'prefix' : '{prefix}',
'data' : '{prefix}/lib/{pyver}/site-packages',
'purelib': '{prefix}/lib/{pyver}/site-packages',
'pl... | python | def get_distribution_paths(name):
"""Return target paths where the package content should be installed"""
pyver = 'python' + sys.version[:3]
paths = {
'prefix' : '{prefix}',
'data' : '{prefix}/lib/{pyver}/site-packages',
'purelib': '{prefix}/lib/{pyver}/site-packages',
'pl... | [
"def",
"get_distribution_paths",
"(",
"name",
")",
":",
"pyver",
"=",
"'python'",
"+",
"sys",
".",
"version",
"[",
":",
"3",
"]",
"paths",
"=",
"{",
"'prefix'",
":",
"'{prefix}'",
",",
"'data'",
":",
"'{prefix}/lib/{pyver}/site-packages'",
",",
"'purelib'",
... | Return target paths where the package content should be installed | [
"Return",
"target",
"paths",
"where",
"the",
"package",
"content",
"should",
"be",
"installed"
] | 27c160ea0adad2771bee12c48a57208a1a3c4d9a | https://github.com/clarete/curdling/blob/27c160ea0adad2771bee12c48a57208a1a3c4d9a/curdling/services/installer.py#L13-L35 |
44,694 | merll/docker-map | dockermap/client/base.py | parse_response | def parse_response(response):
"""
Decodes the JSON response, simply ignoring syntax errors. Therefore it should be used for filtering visible output
only.
:param response: Server response as a JSON string.
:type response: unicode | str
:return: Decoded object from the JSON string. Returns an em... | python | def parse_response(response):
"""
Decodes the JSON response, simply ignoring syntax errors. Therefore it should be used for filtering visible output
only.
:param response: Server response as a JSON string.
:type response: unicode | str
:return: Decoded object from the JSON string. Returns an em... | [
"def",
"parse_response",
"(",
"response",
")",
":",
"if",
"isinstance",
"(",
"response",
",",
"six",
".",
"binary_type",
")",
":",
"response",
"=",
"response",
".",
"decode",
"(",
"'utf-8'",
")",
"try",
":",
"obj",
"=",
"json",
".",
"loads",
"(",
"resp... | Decodes the JSON response, simply ignoring syntax errors. Therefore it should be used for filtering visible output
only.
:param response: Server response as a JSON string.
:type response: unicode | str
:return: Decoded object from the JSON string. Returns an empty dictionary if input was invalid.
:... | [
"Decodes",
"the",
"JSON",
"response",
"simply",
"ignoring",
"syntax",
"errors",
".",
"Therefore",
"it",
"should",
"be",
"used",
"for",
"filtering",
"visible",
"output",
"only",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/base.py#L21-L37 |
44,695 | merll/docker-map | dockermap/client/base.py | DockerClientWrapper.login | def login(self, username, password=None, email=None, registry=None, reauth=False, **kwargs):
"""
Login to a Docker registry server.
:param username: User name for login.
:type username: unicode | str
:param password: Login password; may be ``None`` if blank.
:type passwo... | python | def login(self, username, password=None, email=None, registry=None, reauth=False, **kwargs):
"""
Login to a Docker registry server.
:param username: User name for login.
:type username: unicode | str
:param password: Login password; may be ``None`` if blank.
:type passwo... | [
"def",
"login",
"(",
"self",
",",
"username",
",",
"password",
"=",
"None",
",",
"email",
"=",
"None",
",",
"registry",
"=",
"None",
",",
"reauth",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"super",
"(",
"DockerClientWrapper",
... | Login to a Docker registry server.
:param username: User name for login.
:type username: unicode | str
:param password: Login password; may be ``None`` if blank.
:type password: unicode | str
:param email: Optional; email address for login.
:type email: unicode | str
... | [
"Login",
"to",
"a",
"Docker",
"registry",
"server",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/base.py#L131-L151 |
44,696 | merll/docker-map | dockermap/client/base.py | DockerClientWrapper.push | def push(self, repository, stream=False, raise_on_error=True, **kwargs):
"""
Pushes an image repository to the registry.
:param repository: Name of the repository (can include a tag).
:type repository: unicode | str
:param stream: Use the stream output format with additional sta... | python | def push(self, repository, stream=False, raise_on_error=True, **kwargs):
"""
Pushes an image repository to the registry.
:param repository: Name of the repository (can include a tag).
:type repository: unicode | str
:param stream: Use the stream output format with additional sta... | [
"def",
"push",
"(",
"self",
",",
"repository",
",",
"stream",
"=",
"False",
",",
"raise_on_error",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"response",
"=",
"super",
"(",
"DockerClientWrapper",
",",
"self",
")",
".",
"push",
"(",
"repository",
"... | Pushes an image repository to the registry.
:param repository: Name of the repository (can include a tag).
:type repository: unicode | str
:param stream: Use the stream output format with additional status information.
:type stream: bool
:param raise_on_error: Raises errors in t... | [
"Pushes",
"an",
"image",
"repository",
"to",
"the",
"registry",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/base.py#L177-L197 |
44,697 | merll/docker-map | dockermap/client/base.py | DockerClientWrapper.remove_container | def remove_container(self, container, raise_on_error=True, raise_not_found=False, **kwargs):
"""
Removes a container. For convenience optionally ignores API errors.
:param container: Container name or id.
:type container: unicode | str
:param raise_on_error: Errors on stop and r... | python | def remove_container(self, container, raise_on_error=True, raise_not_found=False, **kwargs):
"""
Removes a container. For convenience optionally ignores API errors.
:param container: Container name or id.
:type container: unicode | str
:param raise_on_error: Errors on stop and r... | [
"def",
"remove_container",
"(",
"self",
",",
"container",
",",
"raise_on_error",
"=",
"True",
",",
"raise_not_found",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"super",
"(",
"DockerClientWrapper",
",",
"self",
")",
".",
"remove_container",... | Removes a container. For convenience optionally ignores API errors.
:param container: Container name or id.
:type container: unicode | str
:param raise_on_error: Errors on stop and removal may result from Docker volume problems, that may not
affect further actions. Such errors are alw... | [
"Removes",
"a",
"container",
".",
"For",
"convenience",
"optionally",
"ignores",
"API",
"errors",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/base.py#L214-L239 |
44,698 | merll/docker-map | dockermap/client/base.py | DockerClientWrapper.stop | def stop(self, container, raise_on_error=True, **kwargs):
"""
Stops a container. For convenience optionally ignores API errors.
:param container: Container name.
:type container: unicode | str
:param raise_on_error: Errors on stop and removal may result from Docker volume proble... | python | def stop(self, container, raise_on_error=True, **kwargs):
"""
Stops a container. For convenience optionally ignores API errors.
:param container: Container name.
:type container: unicode | str
:param raise_on_error: Errors on stop and removal may result from Docker volume proble... | [
"def",
"stop",
"(",
"self",
",",
"container",
",",
"raise_on_error",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"super",
"(",
"DockerClientWrapper",
",",
"self",
")",
".",
"stop",
"(",
"container",
",",
"*",
"*",
"kwargs",
")",
"exce... | Stops a container. For convenience optionally ignores API errors.
:param container: Container name.
:type container: unicode | str
:param raise_on_error: Errors on stop and removal may result from Docker volume problems, that may not
affect further actions. Such errors are always logg... | [
"Stops",
"a",
"container",
".",
"For",
"convenience",
"optionally",
"ignores",
"API",
"errors",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/base.py#L266-L284 |
44,699 | merll/docker-map | dockermap/client/docker_util.py | tag_check_function | def tag_check_function(tags):
"""
Generates a function that checks whether the given image has any of the listed tags.
:param tags: Tags to check for.
:type tags: list[unicode | str] | set[unicode | str]
:return: Function that returns ``True`` if any of the given tags apply to the image, ``False`` ... | python | def tag_check_function(tags):
"""
Generates a function that checks whether the given image has any of the listed tags.
:param tags: Tags to check for.
:type tags: list[unicode | str] | set[unicode | str]
:return: Function that returns ``True`` if any of the given tags apply to the image, ``False`` ... | [
"def",
"tag_check_function",
"(",
"tags",
")",
":",
"suffixes",
"=",
"[",
"':{0}'",
".",
"format",
"(",
"t",
")",
"for",
"t",
"in",
"tags",
"]",
"def",
"_check_image",
"(",
"image",
")",
":",
"repo_tags",
"=",
"image",
"[",
"'RepoTags'",
"]",
"if",
"... | Generates a function that checks whether the given image has any of the listed tags.
:param tags: Tags to check for.
:type tags: list[unicode | str] | set[unicode | str]
:return: Function that returns ``True`` if any of the given tags apply to the image, ``False`` otherwise.
:rtype: (unicode | str) -> ... | [
"Generates",
"a",
"function",
"that",
"checks",
"whether",
"the",
"given",
"image",
"has",
"any",
"of",
"the",
"listed",
"tags",
"."
] | e14fe86a6ff5c33d121eb2f9157e9359cb80dd02 | https://github.com/merll/docker-map/blob/e14fe86a6ff5c33d121eb2f9157e9359cb80dd02/dockermap/client/docker_util.py#L37-L54 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.