partition
stringclasses
3 values
func_name
stringlengths
1
134
docstring
stringlengths
1
46.9k
path
stringlengths
4
223
original_string
stringlengths
75
104k
code
stringlengths
75
104k
docstring_tokens
listlengths
1
1.97k
repo
stringlengths
7
55
language
stringclasses
1 value
url
stringlengths
87
315
code_tokens
listlengths
19
28.4k
sha
stringlengths
40
40
train
Isogeo.dl_hosted
Download hosted resource. :param str token: API auth token :param dict resource_link: link dictionary :param bool encode_clean: option to ensure a clean filename and avoid OS errors :param str proxy_url: proxy to use to download :param str prot: https [DEFAULT] or http ...
isogeo_pysdk/isogeo_sdk.py
def dl_hosted( self, token: dict = None, resource_link: dict = None, encode_clean: bool = 1, proxy_url: str = None, prot: str = "https", ) -> tuple: """Download hosted resource. :param str token: API auth token :param dict resource_link: link ...
def dl_hosted( self, token: dict = None, resource_link: dict = None, encode_clean: bool = 1, proxy_url: str = None, prot: str = "https", ) -> tuple: """Download hosted resource. :param str token: API auth token :param dict resource_link: link ...
[ "Download", "hosted", "resource", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L750-L843
[ "def", "dl_hosted", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "resource_link", ":", "dict", "=", "None", ",", "encode_clean", ":", "bool", "=", "1", ",", "proxy_url", ":", "str", "=", "None", ",", "prot", ":", "str", "=", "\"https\"",...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.xml19139
Get resource exported into XML ISO 19139. :param str token: API auth token :param str id_resource: metadata UUID to export :param str proxy_url: proxy to use to download :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def xml19139( self, token: dict = None, id_resource: str = None, proxy_url=None, prot: str = "https", ): """Get resource exported into XML ISO 19139. :param str token: API auth token :param str id_resource: metadata UUID to export :param str p...
def xml19139( self, token: dict = None, id_resource: str = None, proxy_url=None, prot: str = "https", ): """Get resource exported into XML ISO 19139. :param str token: API auth token :param str id_resource: metadata UUID to export :param str p...
[ "Get", "resource", "exported", "into", "XML", "ISO", "19139", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L846-L884
[ "def", "xml19139", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "id_resource", ":", "str", "=", "None", ",", "proxy_url", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", ":", "# check metadata UUID", "if", "not", "checker...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.add_tags_shares
Add shares list to the tags attributes in search results. :param dict tags: tags dictionary from a search request
isogeo_pysdk/isogeo_sdk.py
def add_tags_shares(self, tags: dict = dict()): """Add shares list to the tags attributes in search results. :param dict tags: tags dictionary from a search request """ # check if shares_id have already been retrieved or not if not hasattr(self, "shares_id"): shares ...
def add_tags_shares(self, tags: dict = dict()): """Add shares list to the tags attributes in search results. :param dict tags: tags dictionary from a search request """ # check if shares_id have already been retrieved or not if not hasattr(self, "shares_id"): shares ...
[ "Add", "shares", "list", "to", "the", "tags", "attributes", "in", "search", "results", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L887-L901
[ "def", "add_tags_shares", "(", "self", ",", "tags", ":", "dict", "=", "dict", "(", ")", ")", ":", "# check if shares_id have already been retrieved or not", "if", "not", "hasattr", "(", "self", ",", "\"shares_id\"", ")", ":", "shares", "=", "self", ".", "share...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.get_app_properties
Get information about the application declared on Isogeo. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def get_app_properties(self, token: dict = None, prot: str = "https"): """Get information about the application declared on Isogeo. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # check if app pro...
def get_app_properties(self, token: dict = None, prot: str = "https"): """Get information about the application declared on Isogeo. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # check if app pro...
[ "Get", "information", "about", "the", "application", "declared", "on", "Isogeo", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L904-L927
[ "def", "get_app_properties", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", ":", "# check if app properties have already been retrieved or not", "if", "not", "hasattr", "(", "self", ",", "\"app_properties\"", "...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.get_directives
Get environment directives which represent INSPIRE limitations. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def get_directives(self, token: dict = None, prot: str = "https") -> dict: """Get environment directives which represent INSPIRE limitations. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # search...
def get_directives(self, token: dict = None, prot: str = "https") -> dict: """Get environment directives which represent INSPIRE limitations. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # search...
[ "Get", "environment", "directives", "which", "represent", "INSPIRE", "limitations", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L951-L969
[ "def", "get_directives", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# search request", "req_url", "=", "\"{}://v1.{}.isogeo.com/directives\"", ".", "format", "(", "prot", ",", "sel...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.get_coordinate_systems
Get available coordinate systems in Isogeo API. :param str token: API auth token :param str srs_code: code of a specific coordinate system :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def get_coordinate_systems( self, token: dict = None, srs_code: str = None, prot: str = "https" ) -> dict: """Get available coordinate systems in Isogeo API. :param str token: API auth token :param str srs_code: code of a specific coordinate system :param str prot: https [DE...
def get_coordinate_systems( self, token: dict = None, srs_code: str = None, prot: str = "https" ) -> dict: """Get available coordinate systems in Isogeo API. :param str token: API auth token :param str srs_code: code of a specific coordinate system :param str prot: https [DE...
[ "Get", "available", "coordinate", "systems", "in", "Isogeo", "API", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L972-L1001
[ "def", "get_coordinate_systems", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "srs_code", ":", "str", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# if specific format", "if", "isinstance", "(", "srs_code", ...
57a604be92c7767b26abd247012cc1a584b386a0
train
Isogeo.get_formats
Get formats. :param str token: API auth token :param str format_code: code of a specific format :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
isogeo_pysdk/isogeo_sdk.py
def get_formats( self, token: dict = None, format_code: str = None, prot: str = "https" ) -> dict: """Get formats. :param str token: API auth token :param str format_code: code of a specific format :param str prot: https [DEFAULT] or http (use it only for dev and tr...
def get_formats( self, token: dict = None, format_code: str = None, prot: str = "https" ) -> dict: """Get formats. :param str token: API auth token :param str format_code: code of a specific format :param str prot: https [DEFAULT] or http (use it only for dev and tr...
[ "Get", "formats", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L1004-L1033
[ "def", "get_formats", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "format_code", ":", "str", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# if specific format", "if", "isinstance", "(", "format_code", ","...
57a604be92c7767b26abd247012cc1a584b386a0
train
parse_bool
Parses boolean value :param v: Input string :param default: Default value if exceptions=False :param exceptions: Raise exception on error or not :return: bool
jutil/parse.py
def parse_bool(v, default=None, exceptions: bool=True) -> bool: """ Parses boolean value :param v: Input string :param default: Default value if exceptions=False :param exceptions: Raise exception on error or not :return: bool """ if isinstance(v, bool): return v s = str(v).l...
def parse_bool(v, default=None, exceptions: bool=True) -> bool: """ Parses boolean value :param v: Input string :param default: Default value if exceptions=False :param exceptions: Raise exception on error or not :return: bool """ if isinstance(v, bool): return v s = str(v).l...
[ "Parses", "boolean", "value", ":", "param", "v", ":", "Input", "string", ":", "param", "default", ":", "Default", "value", "if", "exceptions", "=", "False", ":", "param", "exceptions", ":", "Raise", "exception", "on", "error", "or", "not", ":", "return", ...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/parse.py#L22-L40
[ "def", "parse_bool", "(", "v", ",", "default", "=", "None", ",", "exceptions", ":", "bool", "=", "True", ")", "->", "bool", ":", "if", "isinstance", "(", "v", ",", "bool", ")", ":", "return", "v", "s", "=", "str", "(", "v", ")", ".", "lower", "...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
parse_datetime
Parses datetime :param v: Input string :param default: Default value if exceptions=False :param tz: Default pytz timezone or None if utc :param exceptions: Raise exception on error or not :return: datetime
jutil/parse.py
def parse_datetime(v, default=None, tz=None, exceptions: bool=True) -> datetime: """ Parses datetime :param v: Input string :param default: Default value if exceptions=False :param tz: Default pytz timezone or None if utc :param exceptions: Raise exception on error or not :return: datetime ...
def parse_datetime(v, default=None, tz=None, exceptions: bool=True) -> datetime: """ Parses datetime :param v: Input string :param default: Default value if exceptions=False :param tz: Default pytz timezone or None if utc :param exceptions: Raise exception on error or not :return: datetime ...
[ "Parses", "datetime", ":", "param", "v", ":", "Input", "string", ":", "param", "default", ":", "Default", "value", "if", "exceptions", "=", "False", ":", "param", "tz", ":", "Default", "pytz", "timezone", "or", "None", "if", "utc", ":", "param", "excepti...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/parse.py#L43-L60
[ "def", "parse_datetime", "(", "v", ",", "default", "=", "None", ",", "tz", "=", "None", ",", "exceptions", ":", "bool", "=", "True", ")", "->", "datetime", ":", "try", ":", "t", "=", "dateutil_parse", "(", "v", ",", "default", "=", "datetime", "(", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
convert_boolean
Converts a string to a boolean (see CONVERTERS). There is a converter function for each column type. Boolean strings are independent of case. Values interpreted as True are: "yes", "true", "on", "1". values interpreted as False are "no", "false", "off", "0". Any other value will result in a ValueError....
src/python/pipelines_utils/TypedColumnReader.py
def convert_boolean(string_value): """Converts a string to a boolean (see CONVERTERS). There is a converter function for each column type. Boolean strings are independent of case. Values interpreted as True are: "yes", "true", "on", "1". values interpreted as False are "no", "false", "off", "0". An...
def convert_boolean(string_value): """Converts a string to a boolean (see CONVERTERS). There is a converter function for each column type. Boolean strings are independent of case. Values interpreted as True are: "yes", "true", "on", "1". values interpreted as False are "no", "false", "off", "0". An...
[ "Converts", "a", "string", "to", "a", "boolean", "(", "see", "CONVERTERS", ")", ".", "There", "is", "a", "converter", "function", "for", "each", "column", "type", "." ]
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/TypedColumnReader.py#L68-L88
[ "def", "convert_boolean", "(", "string_value", ")", ":", "lean_string_value", "=", "string_value", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "lean_string_value", "in", "[", "'yes'", ",", "'true'", ",", "'on'", ",", "'1'", "]", ":", "return", ...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
TypedColumnReader._handle_hdr
Given the file header line (or one provided when the object is instantiated) this method populates the ``self._converters`` array, a list of type converters indexed by the column name. :param hdr: The header line. :raises: ContentError for any formatting problems :raises: Unkno...
src/python/pipelines_utils/TypedColumnReader.py
def _handle_hdr(self, hdr): """Given the file header line (or one provided when the object is instantiated) this method populates the ``self._converters`` array, a list of type converters indexed by the column name. :param hdr: The header line. :raises: ContentError for any for...
def _handle_hdr(self, hdr): """Given the file header line (or one provided when the object is instantiated) this method populates the ``self._converters`` array, a list of type converters indexed by the column name. :param hdr: The header line. :raises: ContentError for any for...
[ "Given", "the", "file", "header", "line", "(", "or", "one", "provided", "when", "the", "object", "is", "instantiated", ")", "this", "method", "populates", "the", "self", ".", "_converters", "array", "a", "list", "of", "type", "converters", "indexed", "by", ...
InformaticsMatters/pipelines-utils
python
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/TypedColumnReader.py#L259-L293
[ "def", "_handle_hdr", "(", "self", ",", "hdr", ")", ":", "column_number", "=", "1", "for", "cell", "in", "hdr", ":", "cell_parts", "=", "cell", ".", "split", "(", "self", ".", "_type_sep", ")", "if", "len", "(", "cell_parts", ")", "not", "in", "[", ...
058aa6eceeff28c4ae402f6f58c58720bff0298e
train
DataGouvFr.search_datasets
Search datasets within uData portal.
isogeo_pysdk/samples/udata_client_datagouvfr.py
def search_datasets( self, license=None, format=None, query=None, featured=None, owner=None, organization=None, badge=None, reuses=None, page_size=20, x_fields=None, ): """Search datasets within uData portal.""" ...
def search_datasets( self, license=None, format=None, query=None, featured=None, owner=None, organization=None, badge=None, reuses=None, page_size=20, x_fields=None, ): """Search datasets within uData portal.""" ...
[ "Search", "datasets", "within", "uData", "portal", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/udata_client_datagouvfr.py#L79-L112
[ "def", "search_datasets", "(", "self", ",", "license", "=", "None", ",", "format", "=", "None", ",", "query", "=", "None", ",", "featured", "=", "None", ",", "owner", "=", "None", ",", "organization", "=", "None", ",", "badge", "=", "None", ",", "reu...
57a604be92c7767b26abd247012cc1a584b386a0
train
DataGouvFr.get_filters_values
Get different filters values as dicts.
isogeo_pysdk/samples/udata_client_datagouvfr.py
def get_filters_values(self): """Get different filters values as dicts.""" # DATASETS -- # badges self._DST_BADGES = requests.get(self.base_url + "datasets/badges/").json() # licences self._DST_LICENSES = { l.get("id"): l.get("title") for l in requ...
def get_filters_values(self): """Get different filters values as dicts.""" # DATASETS -- # badges self._DST_BADGES = requests.get(self.base_url + "datasets/badges/").json() # licences self._DST_LICENSES = { l.get("id"): l.get("title") for l in requ...
[ "Get", "different", "filters", "values", "as", "dicts", "." ]
isogeo/isogeo-api-py-minsdk
python
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/udata_client_datagouvfr.py#L115-L167
[ "def", "get_filters_values", "(", "self", ")", ":", "# DATASETS --", "# badges", "self", ".", "_DST_BADGES", "=", "requests", ".", "get", "(", "self", ".", "base_url", "+", "\"datasets/badges/\"", ")", ".", "json", "(", ")", "# licences", "self", ".", "_DST_...
57a604be92c7767b26abd247012cc1a584b386a0
train
deploy
Deploy the app to AppEngine. Args: app_id (str): AppEngine App ID. Overrides config value app_id if given. version (str): AppEngine project version. Overrides config values if given. promote (bool): If set to **True** promote the current remote app versio...
src/peltak_appengine/logic.py
def deploy(app_id, version, promote, quiet): # type: (str, str, bool, bool) -> None """ Deploy the app to AppEngine. Args: app_id (str): AppEngine App ID. Overrides config value app_id if given. version (str): AppEngine project version. Overrides config values if giv...
def deploy(app_id, version, promote, quiet): # type: (str, str, bool, bool) -> None """ Deploy the app to AppEngine. Args: app_id (str): AppEngine App ID. Overrides config value app_id if given. version (str): AppEngine project version. Overrides config values if giv...
[ "Deploy", "the", "app", "to", "AppEngine", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L41-L73
[ "def", "deploy", "(", "app_id", ",", "version", ",", "promote", ",", "quiet", ")", ":", "# type: (str, str, bool, bool) -> None", "gae_app", "=", "GaeApp", ".", "for_branch", "(", "git", ".", "current_branch", "(", ")", ".", "name", ")", "if", "gae_app", "is...
b627acc019e3665875fe76cdca0a14773b69beaa
train
devserver
Run devserver. Args: port (int): Port on which the app will be served. admin_port (int): Port on which the admin interface is served. clear (bool): If set to **True**, clear the datastore on startup.
src/peltak_appengine/logic.py
def devserver(port, admin_port, clear): # type: (int, int, bool) -> None """ Run devserver. Args: port (int): Port on which the app will be served. admin_port (int): Port on which the admin interface is served. clear (bool): If set to **True**, cl...
def devserver(port, admin_port, clear): # type: (int, int, bool) -> None """ Run devserver. Args: port (int): Port on which the app will be served. admin_port (int): Port on which the admin interface is served. clear (bool): If set to **True**, cl...
[ "Run", "devserver", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L77-L100
[ "def", "devserver", "(", "port", ",", "admin_port", ",", "clear", ")", ":", "# type: (int, int, bool) -> None", "admin_port", "=", "admin_port", "or", "(", "port", "+", "1", ")", "args", "=", "[", "'--port={}'", ".", "format", "(", "port", ")", ",", "'--ad...
b627acc019e3665875fe76cdca0a14773b69beaa
train
setup_ci
Setup AppEngine SDK on CircleCI
src/peltak_appengine/logic.py
def setup_ci(): # type: () -> None """ Setup AppEngine SDK on CircleCI """ gcloud_path = shell.run('which gcloud', capture=True).stdout.strip() sdk_path = normpath(join(gcloud_path, '../../platform/google_appengine')) gcloud_cmd = gcloud_path + ' --quiet' if not exists(sdk_path): log.in...
def setup_ci(): # type: () -> None """ Setup AppEngine SDK on CircleCI """ gcloud_path = shell.run('which gcloud', capture=True).stdout.strip() sdk_path = normpath(join(gcloud_path, '../../platform/google_appengine')) gcloud_cmd = gcloud_path + ' --quiet' if not exists(sdk_path): log.in...
[ "Setup", "AppEngine", "SDK", "on", "CircleCI" ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L104-L124
[ "def", "setup_ci", "(", ")", ":", "# type: () -> None", "gcloud_path", "=", "shell", ".", "run", "(", "'which gcloud'", ",", "capture", "=", "True", ")", ".", "stdout", ".", "strip", "(", ")", "sdk_path", "=", "normpath", "(", "join", "(", "gcloud_path", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
mark_experimental
Mark function as experimental. Args: fn (FunctionType): The command function to decorate.
src/peltak/core/util.py
def mark_experimental(fn): # type: (FunctionType) -> FunctionType """ Mark function as experimental. Args: fn (FunctionType): The command function to decorate. """ @wraps(fn) def wrapper(*args, **kw): # pylint: disable=missing-docstring from peltak.core import shel...
def mark_experimental(fn): # type: (FunctionType) -> FunctionType """ Mark function as experimental. Args: fn (FunctionType): The command function to decorate. """ @wraps(fn) def wrapper(*args, **kw): # pylint: disable=missing-docstring from peltak.core import shel...
[ "Mark", "function", "as", "experimental", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L74-L93
[ "def", "mark_experimental", "(", "fn", ")", ":", "# type: (FunctionType) -> FunctionType", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "# pylint: disable=missing-docstring", "from", "peltak", ".", "core", "i...
b627acc019e3665875fe76cdca0a14773b69beaa
train
mark_deprecated
Mark command as deprecated. Args: replaced_by (str): The command that deprecated this command and should be used instead.
src/peltak/core/util.py
def mark_deprecated(replaced_by): # type: (Text) -> FunctionType """ Mark command as deprecated. Args: replaced_by (str): The command that deprecated this command and should be used instead. """ def decorator(fn): # pylint: disable=missing-docstring @wraps(fn) ...
def mark_deprecated(replaced_by): # type: (Text) -> FunctionType """ Mark command as deprecated. Args: replaced_by (str): The command that deprecated this command and should be used instead. """ def decorator(fn): # pylint: disable=missing-docstring @wraps(fn) ...
[ "Mark", "command", "as", "deprecated", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L96-L117
[ "def", "mark_deprecated", "(", "replaced_by", ")", ":", "# type: (Text) -> FunctionType", "def", "decorator", "(", "fn", ")", ":", "# pylint: disable=missing-docstring", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")"...
b627acc019e3665875fe76cdca0a14773b69beaa
train
in_batches
Split the given iterable into batches. Args: iterable (Iterable[Any]): The iterable you want to split into batches. batch_size (int): The size of each bach. The last batch will be probably smaller (if the number of elements cannot be equally divided. Returns...
src/peltak/core/util.py
def in_batches(iterable, batch_size): # type: (Iterable[Any]) -> Generator[List[Any]] """ Split the given iterable into batches. Args: iterable (Iterable[Any]): The iterable you want to split into batches. batch_size (int): The size of each bach. The last batch will ...
def in_batches(iterable, batch_size): # type: (Iterable[Any]) -> Generator[List[Any]] """ Split the given iterable into batches. Args: iterable (Iterable[Any]): The iterable you want to split into batches. batch_size (int): The size of each bach. The last batch will ...
[ "Split", "the", "given", "iterable", "into", "batches", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L186-L217
[ "def", "in_batches", "(", "iterable", ",", "batch_size", ")", ":", "# type: (Iterable[Any]) -> Generator[List[Any]]", "items", "=", "list", "(", "iterable", ")", "size", "=", "len", "(", "items", ")", "for", "i", "in", "range", "(", "0", ",", "size", ",", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
yaml_dump
Dump data to a YAML string/file. Args: data (YamlData): The data to serialize as YAML. stream (TextIO): The file-like object to save to. If given, this function will write the resulting YAML to that stream. Returns: str: The YAML string.
src/peltak/core/util.py
def yaml_dump(data, stream=None): # type: (YamlData, Optional[TextIO]) -> Text """ Dump data to a YAML string/file. Args: data (YamlData): The data to serialize as YAML. stream (TextIO): The file-like object to save to. If given, this function will write ...
def yaml_dump(data, stream=None): # type: (YamlData, Optional[TextIO]) -> Text """ Dump data to a YAML string/file. Args: data (YamlData): The data to serialize as YAML. stream (TextIO): The file-like object to save to. If given, this function will write ...
[ "Dump", "data", "to", "a", "YAML", "string", "/", "file", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L233-L252
[ "def", "yaml_dump", "(", "data", ",", "stream", "=", "None", ")", ":", "# type: (YamlData, Optional[TextIO]) -> Text", "return", "yaml", ".", "dump", "(", "data", ",", "stream", "=", "stream", ",", "Dumper", "=", "Dumper", ",", "default_flow_style", "=", "Fals...
b627acc019e3665875fe76cdca0a14773b69beaa
train
cached_result.clear
Clear result cache on the given function. If the function has no cached result, this call will do nothing. Args: fn (FunctionType): The function whose cache should be cleared.
src/peltak/core/util.py
def clear(cls, fn): # type: (FunctionType) -> None """ Clear result cache on the given function. If the function has no cached result, this call will do nothing. Args: fn (FunctionType): The function whose cache should be cleared. """ if hasa...
def clear(cls, fn): # type: (FunctionType) -> None """ Clear result cache on the given function. If the function has no cached result, this call will do nothing. Args: fn (FunctionType): The function whose cache should be cleared. """ if hasa...
[ "Clear", "result", "cache", "on", "the", "given", "function", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L172-L183
[ "def", "clear", "(", "cls", ",", "fn", ")", ":", "# type: (FunctionType) -> None", "if", "hasattr", "(", "fn", ",", "cls", ".", "CACHE_VAR", ")", ":", "delattr", "(", "fn", ",", "cls", ".", "CACHE_VAR", ")" ]
b627acc019e3665875fe76cdca0a14773b69beaa
train
start
Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature.
src/peltak/extra/gitflow/logic/task.py
def start(name): # type: (str) -> None """ Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature. """ branch = git.current_branch(refresh=True) task_branch ...
def start(name): # type: (str) -> None """ Start working on a new feature by branching off develop. This will create a new branch off develop called feature/<name>. Args: name (str): The name of the new feature. """ branch = git.current_branch(refresh=True) task_branch ...
[ "Start", "working", "on", "a", "new", "feature", "by", "branching", "off", "develop", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L33-L51
[ "def", "start", "(", "name", ")", ":", "# type: (str) -> None", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "task_branch", "=", "'task/'", "+", "common", ".", "to_branch_name", "(", "name", ")", "if", "branch", ".", "type...
b627acc019e3665875fe76cdca0a14773b69beaa
train
update
Update the feature with updates committed to develop. This will merge current develop into the current branch.
src/peltak/extra/gitflow/logic/task.py
def update(): # type: () -> None """ Update the feature with updates committed to develop. This will merge current develop into the current branch. """ branch = git.current_branch(refresh=True) base_branch = common.get_base_branch() common.assert_branch_type('task') common.git_checkout...
def update(): # type: () -> None """ Update the feature with updates committed to develop. This will merge current develop into the current branch. """ branch = git.current_branch(refresh=True) base_branch = common.get_base_branch() common.assert_branch_type('task') common.git_checkout...
[ "Update", "the", "feature", "with", "updates", "committed", "to", "develop", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L54-L67
[ "def", "update", "(", ")", ":", "# type: () -> None", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "base_branch", "=", "common", ".", "get_base_branch", "(", ")", "common", ".", "assert_branch_type", "(", "'task'", ")", "com...
b627acc019e3665875fe76cdca0a14773b69beaa
train
finish
Merge current feature branch into develop.
src/peltak/extra/gitflow/logic/task.py
def finish(): # type: () -> None """ Merge current feature branch into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you mer...
def finish(): # type: () -> None """ Merge current feature branch into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you mer...
[ "Merge", "current", "feature", "branch", "into", "develop", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L83-L114
[ "def", "finish", "(", ")", ":", "# type: () -> None", "pretend", "=", "context", ".", "get", "(", "'pretend'", ",", "False", ")", "if", "not", "pretend", "and", "(", "git", ".", "staged", "(", ")", "or", "git", ".", "unstaged", "(", ")", ")", ":", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
merged
Cleanup a remotely merged branch.
src/peltak/extra/gitflow/logic/task.py
def merged(): # type: () -> None """ Cleanup a remotely merged branch. """ base_branch = common.get_base_branch() branch = git.current_branch(refresh=True) common.assert_branch_type('task') # Pull feature branch with the merged task common.git_checkout(base_branch) common.git_pull(base...
def merged(): # type: () -> None """ Cleanup a remotely merged branch. """ base_branch = common.get_base_branch() branch = git.current_branch(refresh=True) common.assert_branch_type('task') # Pull feature branch with the merged task common.git_checkout(base_branch) common.git_pull(base...
[ "Cleanup", "a", "remotely", "merged", "branch", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L117-L133
[ "def", "merged", "(", ")", ":", "# type: () -> None", "base_branch", "=", "common", ".", "get_base_branch", "(", ")", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "common", ".", "assert_branch_type", "(", "'task'", ")", "# P...
b627acc019e3665875fe76cdca0a14773b69beaa
train
mutagen_call
Call a Mutagen function with appropriate error handling. `action` is a string describing what the function is trying to do, and `path` is the relevant filename. The rest of the arguments describe the callable to invoke. We require at least Mutagen 1.33, where `IOError` is *never* used, neither for...
phrydy/mediafile.py
def mutagen_call(action, path, func, *args, **kwargs): """Call a Mutagen function with appropriate error handling. `action` is a string describing what the function is trying to do, and `path` is the relevant filename. The rest of the arguments describe the callable to invoke. We require at least ...
def mutagen_call(action, path, func, *args, **kwargs): """Call a Mutagen function with appropriate error handling. `action` is a string describing what the function is trying to do, and `path` is the relevant filename. The rest of the arguments describe the callable to invoke. We require at least ...
[ "Call", "a", "Mutagen", "function", "with", "appropriate", "error", "handling", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L117-L139
[ "def", "mutagen_call", "(", "action", ",", "path", ",", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "mutagen", ".", "MutagenError", "as", "exc"...
aa13755155977b4776e49f79984f9968ac1d74dc
train
_safe_cast
Try to covert val to out_type but never raise an exception. If the value can't be converted, then a sensible default value is returned. out_type should be bool, int, or unicode; otherwise, the value is just passed through.
phrydy/mediafile.py
def _safe_cast(out_type, val): """Try to covert val to out_type but never raise an exception. If the value can't be converted, then a sensible default value is returned. out_type should be bool, int, or unicode; otherwise, the value is just passed through. """ if val is None: return None...
def _safe_cast(out_type, val): """Try to covert val to out_type but never raise an exception. If the value can't be converted, then a sensible default value is returned. out_type should be bool, int, or unicode; otherwise, the value is just passed through. """ if val is None: return None...
[ "Try", "to", "covert", "val", "to", "out_type", "but", "never", "raise", "an", "exception", ".", "If", "the", "value", "can", "t", "be", "converted", "then", "a", "sensible", "default", "value", "is", "returned", ".", "out_type", "should", "be", "bool", ...
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L144-L199
[ "def", "_safe_cast", "(", "out_type", ",", "val", ")", ":", "if", "val", "is", "None", ":", "return", "None", "if", "out_type", "==", "int", ":", "if", "isinstance", "(", "val", ",", "int", ")", "or", "isinstance", "(", "val", ",", "float", ")", ":...
aa13755155977b4776e49f79984f9968ac1d74dc
train
_unpack_asf_image
Unpack image data from a WM/Picture tag. Return a tuple containing the MIME type, the raw image data, a type indicator, and the image's description. This function is treated as "untrusted" and could throw all manner of exceptions (out-of-bounds, etc.). We should clean this up sometime so that the f...
phrydy/mediafile.py
def _unpack_asf_image(data): """Unpack image data from a WM/Picture tag. Return a tuple containing the MIME type, the raw image data, a type indicator, and the image's description. This function is treated as "untrusted" and could throw all manner of exceptions (out-of-bounds, etc.). We should clea...
def _unpack_asf_image(data): """Unpack image data from a WM/Picture tag. Return a tuple containing the MIME type, the raw image data, a type indicator, and the image's description. This function is treated as "untrusted" and could throw all manner of exceptions (out-of-bounds, etc.). We should clea...
[ "Unpack", "image", "data", "from", "a", "WM", "/", "Picture", "tag", ".", "Return", "a", "tuple", "containing", "the", "MIME", "type", "the", "raw", "image", "data", "a", "type", "indicator", "and", "the", "image", "s", "description", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L204-L227
[ "def", "_unpack_asf_image", "(", "data", ")", ":", "type", ",", "size", "=", "struct", ".", "unpack_from", "(", "'<bi'", ",", "data", ")", "pos", "=", "5", "mime", "=", "b''", "while", "data", "[", "pos", ":", "pos", "+", "2", "]", "!=", "b'\\x00\\...
aa13755155977b4776e49f79984f9968ac1d74dc
train
_pack_asf_image
Pack image data for a WM/Picture tag.
phrydy/mediafile.py
def _pack_asf_image(mime, data, type=3, description=""): """Pack image data for a WM/Picture tag. """ tag_data = struct.pack('<bi', type, len(data)) tag_data += mime.encode("utf-16-le") + b'\x00\x00' tag_data += description.encode("utf-16-le") + b'\x00\x00' tag_data += data return tag_data
def _pack_asf_image(mime, data, type=3, description=""): """Pack image data for a WM/Picture tag. """ tag_data = struct.pack('<bi', type, len(data)) tag_data += mime.encode("utf-16-le") + b'\x00\x00' tag_data += description.encode("utf-16-le") + b'\x00\x00' tag_data += data return tag_data
[ "Pack", "image", "data", "for", "a", "WM", "/", "Picture", "tag", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L230-L237
[ "def", "_pack_asf_image", "(", "mime", ",", "data", ",", "type", "=", "3", ",", "description", "=", "\"\"", ")", ":", "tag_data", "=", "struct", ".", "pack", "(", "'<bi'", ",", "type", ",", "len", "(", "data", ")", ")", "tag_data", "+=", "mime", "....
aa13755155977b4776e49f79984f9968ac1d74dc
train
_sc_decode
Convert a Sound Check bytestring value to a (gain, peak) tuple as used by ReplayGain.
phrydy/mediafile.py
def _sc_decode(soundcheck): """Convert a Sound Check bytestring value to a (gain, peak) tuple as used by ReplayGain. """ # We decode binary data. If one of the formats gives us a text # string, interpret it as UTF-8. if isinstance(soundcheck, six.text_type): soundcheck = soundcheck.encod...
def _sc_decode(soundcheck): """Convert a Sound Check bytestring value to a (gain, peak) tuple as used by ReplayGain. """ # We decode binary data. If one of the formats gives us a text # string, interpret it as UTF-8. if isinstance(soundcheck, six.text_type): soundcheck = soundcheck.encod...
[ "Convert", "a", "Sound", "Check", "bytestring", "value", "to", "a", "(", "gain", "peak", ")", "tuple", "as", "used", "by", "ReplayGain", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L242-L280
[ "def", "_sc_decode", "(", "soundcheck", ")", ":", "# We decode binary data. If one of the formats gives us a text", "# string, interpret it as UTF-8.", "if", "isinstance", "(", "soundcheck", ",", "six", ".", "text_type", ")", ":", "soundcheck", "=", "soundcheck", ".", "en...
aa13755155977b4776e49f79984f9968ac1d74dc
train
_sc_encode
Encode ReplayGain gain/peak values as a Sound Check string.
phrydy/mediafile.py
def _sc_encode(gain, peak): """Encode ReplayGain gain/peak values as a Sound Check string. """ # SoundCheck stores the peak value as the actual value of the # sample, rather than the percentage of full scale that RG uses, so # we do a simple conversion assuming 16 bit samples. peak *= 32768.0 ...
def _sc_encode(gain, peak): """Encode ReplayGain gain/peak values as a Sound Check string. """ # SoundCheck stores the peak value as the actual value of the # sample, rather than the percentage of full scale that RG uses, so # we do a simple conversion assuming 16 bit samples. peak *= 32768.0 ...
[ "Encode", "ReplayGain", "gain", "/", "peak", "values", "as", "a", "Sound", "Check", "string", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L283-L304
[ "def", "_sc_encode", "(", "gain", ",", "peak", ")", ":", "# SoundCheck stores the peak value as the actual value of the", "# sample, rather than the percentage of full scale that RG uses, so", "# we do a simple conversion assuming 16 bit samples.", "peak", "*=", "32768.0", "# SoundCheck ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
image_mime_type
Return the MIME type of the image data (a bytestring).
phrydy/mediafile.py
def image_mime_type(data): """Return the MIME type of the image data (a bytestring). """ # This checks for a jpeg file with only the magic bytes (unrecognized by # imghdr.what). imghdr.what returns none for that type of file, so # _wider_test_jpeg is run in that case. It still returns None if it did...
def image_mime_type(data): """Return the MIME type of the image data (a bytestring). """ # This checks for a jpeg file with only the magic bytes (unrecognized by # imghdr.what). imghdr.what returns none for that type of file, so # _wider_test_jpeg is run in that case. It still returns None if it did...
[ "Return", "the", "MIME", "type", "of", "the", "image", "data", "(", "a", "bytestring", ")", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L329-L348
[ "def", "image_mime_type", "(", "data", ")", ":", "# This checks for a jpeg file with only the magic bytes (unrecognized by", "# imghdr.what). imghdr.what returns none for that type of file, so", "# _wider_test_jpeg is run in that case. It still returns None if it didn't", "# match such a jpeg file...
aa13755155977b4776e49f79984f9968ac1d74dc
train
StorageStyle.deserialize
Given a raw value stored on a Mutagen object, decode and return the represented value.
phrydy/mediafile.py
def deserialize(self, mutagen_value): """Given a raw value stored on a Mutagen object, decode and return the represented value. """ if self.suffix and isinstance(mutagen_value, six.text_type) \ and mutagen_value.endswith(self.suffix): return mutagen_value[:-len(sel...
def deserialize(self, mutagen_value): """Given a raw value stored on a Mutagen object, decode and return the represented value. """ if self.suffix and isinstance(mutagen_value, six.text_type) \ and mutagen_value.endswith(self.suffix): return mutagen_value[:-len(sel...
[ "Given", "a", "raw", "value", "stored", "on", "a", "Mutagen", "object", "decode", "and", "return", "the", "represented", "value", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L494-L502
[ "def", "deserialize", "(", "self", ",", "mutagen_value", ")", ":", "if", "self", ".", "suffix", "and", "isinstance", "(", "mutagen_value", ",", "six", ".", "text_type", ")", "and", "mutagen_value", ".", "endswith", "(", "self", ".", "suffix", ")", ":", "...
aa13755155977b4776e49f79984f9968ac1d74dc
train
StorageStyle.set
Assign the value for the field using this style.
phrydy/mediafile.py
def set(self, mutagen_file, value): """Assign the value for the field using this style. """ self.store(mutagen_file, self.serialize(value))
def set(self, mutagen_file, value): """Assign the value for the field using this style. """ self.store(mutagen_file, self.serialize(value))
[ "Assign", "the", "value", "for", "the", "field", "using", "this", "style", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L506-L509
[ "def", "set", "(", "self", ",", "mutagen_file", ",", "value", ")", ":", "self", ".", "store", "(", "mutagen_file", ",", "self", ".", "serialize", "(", "value", ")", ")" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
StorageStyle.serialize
Convert the external Python value to a type that is suitable for storing in a Mutagen file object.
phrydy/mediafile.py
def serialize(self, value): """Convert the external Python value to a type that is suitable for storing in a Mutagen file object. """ if isinstance(value, float) and self.as_type is six.text_type: value = u'{0:.{1}f}'.format(value, self.float_places) value = self....
def serialize(self, value): """Convert the external Python value to a type that is suitable for storing in a Mutagen file object. """ if isinstance(value, float) and self.as_type is six.text_type: value = u'{0:.{1}f}'.format(value, self.float_places) value = self....
[ "Convert", "the", "external", "Python", "value", "to", "a", "type", "that", "is", "suitable", "for", "storing", "in", "a", "Mutagen", "file", "object", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L516-L537
[ "def", "serialize", "(", "self", ",", "value", ")", ":", "if", "isinstance", "(", "value", ",", "float", ")", "and", "self", ".", "as_type", "is", "six", ".", "text_type", ":", "value", "=", "u'{0:.{1}f}'", ".", "format", "(", "value", ",", "self", "...
aa13755155977b4776e49f79984f9968ac1d74dc
train
ListStorageStyle.get_list
Get a list of all values for the field using this style.
phrydy/mediafile.py
def get_list(self, mutagen_file): """Get a list of all values for the field using this style. """ return [self.deserialize(item) for item in self.fetch(mutagen_file)]
def get_list(self, mutagen_file): """Get a list of all values for the field using this style. """ return [self.deserialize(item) for item in self.fetch(mutagen_file)]
[ "Get", "a", "list", "of", "all", "values", "for", "the", "field", "using", "this", "style", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L569-L572
[ "def", "get_list", "(", "self", ",", "mutagen_file", ")", ":", "return", "[", "self", ".", "deserialize", "(", "item", ")", "for", "item", "in", "self", ".", "fetch", "(", "mutagen_file", ")", "]" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
ListStorageStyle.set_list
Set all values for the field using this style. `values` should be an iterable.
phrydy/mediafile.py
def set_list(self, mutagen_file, values): """Set all values for the field using this style. `values` should be an iterable. """ self.store(mutagen_file, [self.serialize(value) for value in values])
def set_list(self, mutagen_file, values): """Set all values for the field using this style. `values` should be an iterable. """ self.store(mutagen_file, [self.serialize(value) for value in values])
[ "Set", "all", "values", "for", "the", "field", "using", "this", "style", ".", "values", "should", "be", "an", "iterable", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L588-L592
[ "def", "set_list", "(", "self", ",", "mutagen_file", ",", "values", ")", ":", "self", ".", "store", "(", "mutagen_file", ",", "[", "self", ".", "serialize", "(", "value", ")", "for", "value", "in", "values", "]", ")" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MP3ImageStorageStyle.deserialize
Convert APIC frame into Image.
phrydy/mediafile.py
def deserialize(self, apic_frame): """Convert APIC frame into Image.""" return Image(data=apic_frame.data, desc=apic_frame.desc, type=apic_frame.type)
def deserialize(self, apic_frame): """Convert APIC frame into Image.""" return Image(data=apic_frame.data, desc=apic_frame.desc, type=apic_frame.type)
[ "Convert", "APIC", "frame", "into", "Image", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L933-L936
[ "def", "deserialize", "(", "self", ",", "apic_frame", ")", ":", "return", "Image", "(", "data", "=", "apic_frame", ".", "data", ",", "desc", "=", "apic_frame", ".", "desc", ",", "type", "=", "apic_frame", ".", "type", ")" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MP3ImageStorageStyle.serialize
Return an APIC frame populated with data from ``image``.
phrydy/mediafile.py
def serialize(self, image): """Return an APIC frame populated with data from ``image``. """ assert isinstance(image, Image) frame = mutagen.id3.Frames[self.key]() frame.data = image.data frame.mime = image.mime_type frame.desc = image.desc or u'' # For co...
def serialize(self, image): """Return an APIC frame populated with data from ``image``. """ assert isinstance(image, Image) frame = mutagen.id3.Frames[self.key]() frame.data = image.data frame.mime = image.mime_type frame.desc = image.desc or u'' # For co...
[ "Return", "an", "APIC", "frame", "populated", "with", "data", "from", "image", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L947-L966
[ "def", "serialize", "(", "self", ",", "image", ")", ":", "assert", "isinstance", "(", "image", ",", "Image", ")", "frame", "=", "mutagen", ".", "id3", ".", "Frames", "[", "self", ".", "key", "]", "(", ")", "frame", ".", "data", "=", "image", ".", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
VorbisImageStorageStyle.serialize
Turn a Image into a base64 encoded FLAC picture block.
phrydy/mediafile.py
def serialize(self, image): """Turn a Image into a base64 encoded FLAC picture block. """ pic = mutagen.flac.Picture() pic.data = image.data pic.type = image.type_index pic.mime = image.mime_type pic.desc = image.desc or u'' # Encoding with base64 returns...
def serialize(self, image): """Turn a Image into a base64 encoded FLAC picture block. """ pic = mutagen.flac.Picture() pic.data = image.data pic.type = image.type_index pic.mime = image.mime_type pic.desc = image.desc or u'' # Encoding with base64 returns...
[ "Turn", "a", "Image", "into", "a", "base64", "encoded", "FLAC", "picture", "block", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1036-L1048
[ "def", "serialize", "(", "self", ",", "image", ")", ":", "pic", "=", "mutagen", ".", "flac", ".", "Picture", "(", ")", "pic", ".", "data", "=", "image", ".", "data", "pic", ".", "type", "=", "image", ".", "type_index", "pic", ".", "mime", "=", "i...
aa13755155977b4776e49f79984f9968ac1d74dc
train
FlacImageStorageStyle.store
``pictures`` is a list of mutagen.flac.Picture instances.
phrydy/mediafile.py
def store(self, mutagen_file, pictures): """``pictures`` is a list of mutagen.flac.Picture instances. """ mutagen_file.clear_pictures() for pic in pictures: mutagen_file.add_picture(pic)
def store(self, mutagen_file, pictures): """``pictures`` is a list of mutagen.flac.Picture instances. """ mutagen_file.clear_pictures() for pic in pictures: mutagen_file.add_picture(pic)
[ "pictures", "is", "a", "list", "of", "mutagen", ".", "flac", ".", "Picture", "instances", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1066-L1071
[ "def", "store", "(", "self", ",", "mutagen_file", ",", "pictures", ")", ":", "mutagen_file", ".", "clear_pictures", "(", ")", "for", "pic", "in", "pictures", ":", "mutagen_file", ".", "add_picture", "(", "pic", ")" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
FlacImageStorageStyle.serialize
Turn a Image into a mutagen.flac.Picture.
phrydy/mediafile.py
def serialize(self, image): """Turn a Image into a mutagen.flac.Picture. """ pic = mutagen.flac.Picture() pic.data = image.data pic.type = image.type_index pic.mime = image.mime_type pic.desc = image.desc or u'' return pic
def serialize(self, image): """Turn a Image into a mutagen.flac.Picture. """ pic = mutagen.flac.Picture() pic.data = image.data pic.type = image.type_index pic.mime = image.mime_type pic.desc = image.desc or u'' return pic
[ "Turn", "a", "Image", "into", "a", "mutagen", ".", "flac", ".", "Picture", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1073-L1081
[ "def", "serialize", "(", "self", ",", "image", ")", ":", "pic", "=", "mutagen", ".", "flac", ".", "Picture", "(", ")", "pic", ".", "data", "=", "image", ".", "data", "pic", ".", "type", "=", "image", ".", "type_index", "pic", ".", "mime", "=", "i...
aa13755155977b4776e49f79984f9968ac1d74dc
train
APEv2ImageStorageStyle.delete
Remove all images from the file.
phrydy/mediafile.py
def delete(self, mutagen_file): """Remove all images from the file. """ for cover_tag in self.TAG_NAMES.values(): try: del mutagen_file[cover_tag] except KeyError: pass
def delete(self, mutagen_file): """Remove all images from the file. """ for cover_tag in self.TAG_NAMES.values(): try: del mutagen_file[cover_tag] except KeyError: pass
[ "Remove", "all", "images", "from", "the", "file", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1150-L1157
[ "def", "delete", "(", "self", ",", "mutagen_file", ")", ":", "for", "cover_tag", "in", "self", ".", "TAG_NAMES", ".", "values", "(", ")", ":", "try", ":", "del", "mutagen_file", "[", "cover_tag", "]", "except", "KeyError", ":", "pass" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaField.styles
Yields the list of storage styles of this field that can handle the MediaFile's format.
phrydy/mediafile.py
def styles(self, mutagen_file): """Yields the list of storage styles of this field that can handle the MediaFile's format. """ for style in self._styles: if mutagen_file.__class__.__name__ in style.formats: yield style
def styles(self, mutagen_file): """Yields the list of storage styles of this field that can handle the MediaFile's format. """ for style in self._styles: if mutagen_file.__class__.__name__ in style.formats: yield style
[ "Yields", "the", "list", "of", "storage", "styles", "of", "this", "field", "that", "can", "handle", "the", "MediaFile", "s", "format", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1183-L1189
[ "def", "styles", "(", "self", ",", "mutagen_file", ")", ":", "for", "style", "in", "self", ".", "_styles", ":", "if", "mutagen_file", ".", "__class__", ".", "__name__", "in", "style", ".", "formats", ":", "yield", "style" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaField._none_value
Get an appropriate "null" value for this field's type. This is used internally when setting the field to None.
phrydy/mediafile.py
def _none_value(self): """Get an appropriate "null" value for this field's type. This is used internally when setting the field to None. """ if self.out_type == int: return 0 elif self.out_type == float: return 0.0 elif self.out_type == bool: ...
def _none_value(self): """Get an appropriate "null" value for this field's type. This is used internally when setting the field to None. """ if self.out_type == int: return 0 elif self.out_type == float: return 0.0 elif self.out_type == bool: ...
[ "Get", "an", "appropriate", "null", "value", "for", "this", "field", "s", "type", ".", "This", "is", "used", "internally", "when", "setting", "the", "field", "to", "None", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1209-L1220
[ "def", "_none_value", "(", "self", ")", ":", "if", "self", ".", "out_type", "==", "int", ":", "return", "0", "elif", "self", ".", "out_type", "==", "float", ":", "return", "0.0", "elif", "self", ".", "out_type", "==", "bool", ":", "return", "False", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
DateField._get_date_tuple
Get a 3-item sequence representing the date consisting of a year, month, and day number. Each number is either an integer or None.
phrydy/mediafile.py
def _get_date_tuple(self, mediafile): """Get a 3-item sequence representing the date consisting of a year, month, and day number. Each number is either an integer or None. """ # Get the underlying data and split on hyphens and slashes. datestring = super(DateField, self)....
def _get_date_tuple(self, mediafile): """Get a 3-item sequence representing the date consisting of a year, month, and day number. Each number is either an integer or None. """ # Get the underlying data and split on hyphens and slashes. datestring = super(DateField, self)....
[ "Get", "a", "3", "-", "item", "sequence", "representing", "the", "date", "consisting", "of", "a", "year", "month", "and", "day", "number", ".", "Each", "number", "is", "either", "an", "integer", "or", "None", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1293-L1323
[ "def", "_get_date_tuple", "(", "self", ",", "mediafile", ")", ":", "# Get the underlying data and split on hyphens and slashes.", "datestring", "=", "super", "(", "DateField", ",", "self", ")", ".", "__get__", "(", "mediafile", ",", "None", ")", "if", "isinstance", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
DateField._set_date_tuple
Set the value of the field given a year, month, and day number. Each number can be an integer or None to indicate an unset component.
phrydy/mediafile.py
def _set_date_tuple(self, mediafile, year, month=None, day=None): """Set the value of the field given a year, month, and day number. Each number can be an integer or None to indicate an unset component. """ if year is None: self.__delete__(mediafile) retur...
def _set_date_tuple(self, mediafile, year, month=None, day=None): """Set the value of the field given a year, month, and day number. Each number can be an integer or None to indicate an unset component. """ if year is None: self.__delete__(mediafile) retur...
[ "Set", "the", "value", "of", "the", "field", "given", "a", "year", "month", "and", "day", "number", ".", "Each", "number", "can", "be", "an", "integer", "or", "None", "to", "indicate", "an", "unset", "component", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1325-L1343
[ "def", "_set_date_tuple", "(", "self", ",", "mediafile", ",", "year", ",", "month", "=", "None", ",", "day", "=", "None", ")", ":", "if", "year", "is", "None", ":", "self", ".", "__delete__", "(", "mediafile", ")", "return", "date", "=", "[", "u'{0:0...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.save
Write the object's tags back to the file. May throw `UnreadableFileError`.
phrydy/mediafile.py
def save(self): """Write the object's tags back to the file. May throw `UnreadableFileError`. """ # Possibly save the tags to ID3v2.3. kwargs = {} if self.id3v23: id3 = self.mgfile if hasattr(id3, 'tags'): # In case this is an MP3 o...
def save(self): """Write the object's tags back to the file. May throw `UnreadableFileError`. """ # Possibly save the tags to ID3v2.3. kwargs = {} if self.id3v23: id3 = self.mgfile if hasattr(id3, 'tags'): # In case this is an MP3 o...
[ "Write", "the", "object", "s", "tags", "back", "to", "the", "file", ".", "May", "throw", "UnreadableFileError", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1492-L1506
[ "def", "save", "(", "self", ")", ":", "# Possibly save the tags to ID3v2.3.", "kwargs", "=", "{", "}", "if", "self", ".", "id3v23", ":", "id3", "=", "self", ".", "mgfile", "if", "hasattr", "(", "id3", ",", "'tags'", ")", ":", "# In case this is an MP3 object...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.fields
Get the names of all writable properties that reflect metadata tags (i.e., those that are instances of :class:`MediaField`).
phrydy/mediafile.py
def fields(cls): """Get the names of all writable properties that reflect metadata tags (i.e., those that are instances of :class:`MediaField`). """ for property, descriptor in cls.__dict__.items(): if isinstance(descriptor, MediaField): if isinstance(...
def fields(cls): """Get the names of all writable properties that reflect metadata tags (i.e., those that are instances of :class:`MediaField`). """ for property, descriptor in cls.__dict__.items(): if isinstance(descriptor, MediaField): if isinstance(...
[ "Get", "the", "names", "of", "all", "writable", "properties", "that", "reflect", "metadata", "tags", "(", "i", ".", "e", ".", "those", "that", "are", "instances", "of", ":", "class", ":", "MediaField", ")", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1517-L1529
[ "def", "fields", "(", "cls", ")", ":", "for", "property", ",", "descriptor", "in", "cls", ".", "__dict__", ".", "items", "(", ")", ":", "if", "isinstance", "(", "descriptor", ",", "MediaField", ")", ":", "if", "isinstance", "(", "property", ",", "bytes...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile._field_sort_name
Get a sort key for a field name that determines the order fields should be written in. Fields names are kept unchanged, unless they are instances of :class:`DateItemField`, in which case `year`, `month`, and `day` are replaced by `date0`, `date1`, and `date2`, respectively, to m...
phrydy/mediafile.py
def _field_sort_name(cls, name): """Get a sort key for a field name that determines the order fields should be written in. Fields names are kept unchanged, unless they are instances of :class:`DateItemField`, in which case `year`, `month`, and `day` are replaced by `date0`, `dat...
def _field_sort_name(cls, name): """Get a sort key for a field name that determines the order fields should be written in. Fields names are kept unchanged, unless they are instances of :class:`DateItemField`, in which case `year`, `month`, and `day` are replaced by `date0`, `dat...
[ "Get", "a", "sort", "key", "for", "a", "field", "name", "that", "determines", "the", "order", "fields", "should", "be", "written", "in", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1532-L1545
[ "def", "_field_sort_name", "(", "cls", ",", "name", ")", ":", "if", "isinstance", "(", "cls", ".", "__dict__", "[", "name", "]", ",", "DateItemField", ")", ":", "name", "=", "re", ".", "sub", "(", "'year'", ",", "'date0'", ",", "name", ")", "name", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.sorted_fields
Get the names of all writable metadata fields, sorted in the order that they should be written. This is a lexicographic order, except for instances of :class:`DateItemField`, which are sorted in year-month-day order.
phrydy/mediafile.py
def sorted_fields(cls): """Get the names of all writable metadata fields, sorted in the order that they should be written. This is a lexicographic order, except for instances of :class:`DateItemField`, which are sorted in year-month-day order. """ for property in...
def sorted_fields(cls): """Get the names of all writable metadata fields, sorted in the order that they should be written. This is a lexicographic order, except for instances of :class:`DateItemField`, which are sorted in year-month-day order. """ for property in...
[ "Get", "the", "names", "of", "all", "writable", "metadata", "fields", "sorted", "in", "the", "order", "that", "they", "should", "be", "written", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1548-L1557
[ "def", "sorted_fields", "(", "cls", ")", ":", "for", "property", "in", "sorted", "(", "cls", ".", "fields", "(", ")", ",", "key", "=", "cls", ".", "_field_sort_name", ")", ":", "yield", "property" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.add_field
Add a field to store custom tags. :param name: the name of the property the field is accessed through. It must not already exist on this class. :param descriptor: an instance of :class:`MediaField`.
phrydy/mediafile.py
def add_field(cls, name, descriptor): """Add a field to store custom tags. :param name: the name of the property the field is accessed through. It must not already exist on this class. :param descriptor: an instance of :class:`MediaField`. """ if not isinst...
def add_field(cls, name, descriptor): """Add a field to store custom tags. :param name: the name of the property the field is accessed through. It must not already exist on this class. :param descriptor: an instance of :class:`MediaField`. """ if not isinst...
[ "Add", "a", "field", "to", "store", "custom", "tags", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1571-L1585
[ "def", "add_field", "(", "cls", ",", "name", ",", "descriptor", ")", ":", "if", "not", "isinstance", "(", "descriptor", ",", "MediaField", ")", ":", "raise", "ValueError", "(", "u'{0} must be an instance of MediaField'", ".", "format", "(", "descriptor", ")", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.update
Set all field values from a dictionary. For any key in `dict` that is also a field to store tags the method retrieves the corresponding value from `dict` and updates the `MediaFile`. If a key has the value `None`, the corresponding property is deleted from the `MediaFile`.
phrydy/mediafile.py
def update(self, dict): """Set all field values from a dictionary. For any key in `dict` that is also a field to store tags the method retrieves the corresponding value from `dict` and updates the `MediaFile`. If a key has the value `None`, the corresponding property is deleted ...
def update(self, dict): """Set all field values from a dictionary. For any key in `dict` that is also a field to store tags the method retrieves the corresponding value from `dict` and updates the `MediaFile`. If a key has the value `None`, the corresponding property is deleted ...
[ "Set", "all", "field", "values", "from", "a", "dictionary", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1587-L1600
[ "def", "update", "(", "self", ",", "dict", ")", ":", "for", "field", "in", "self", ".", "sorted_fields", "(", ")", ":", "if", "field", "in", "dict", ":", "if", "dict", "[", "field", "]", "is", "None", ":", "delattr", "(", "self", ",", "field", ")...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.samplerate
The audio's sample rate (an int).
phrydy/mediafile.py
def samplerate(self): """The audio's sample rate (an int).""" if hasattr(self.mgfile.info, 'sample_rate'): return self.mgfile.info.sample_rate elif self.type == 'opus': # Opus is always 48kHz internally. return 48000 return 0
def samplerate(self): """The audio's sample rate (an int).""" if hasattr(self.mgfile.info, 'sample_rate'): return self.mgfile.info.sample_rate elif self.type == 'opus': # Opus is always 48kHz internally. return 48000 return 0
[ "The", "audio", "s", "sample", "rate", "(", "an", "int", ")", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2162-L2169
[ "def", "samplerate", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'sample_rate'", ")", ":", "return", "self", ".", "mgfile", ".", "info", ".", "sample_rate", "elif", "self", ".", "type", "==", "'opus'", ":", ...
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.bitdepth
The number of bits per sample in the audio encoding (an int). Only available for certain file formats (zero where unavailable).
phrydy/mediafile.py
def bitdepth(self): """The number of bits per sample in the audio encoding (an int). Only available for certain file formats (zero where unavailable). """ if hasattr(self.mgfile.info, 'bits_per_sample'): return self.mgfile.info.bits_per_sample return 0
def bitdepth(self): """The number of bits per sample in the audio encoding (an int). Only available for certain file formats (zero where unavailable). """ if hasattr(self.mgfile.info, 'bits_per_sample'): return self.mgfile.info.bits_per_sample return 0
[ "The", "number", "of", "bits", "per", "sample", "in", "the", "audio", "encoding", "(", "an", "int", ")", ".", "Only", "available", "for", "certain", "file", "formats", "(", "zero", "where", "unavailable", ")", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2172-L2179
[ "def", "bitdepth", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'bits_per_sample'", ")", ":", "return", "self", ".", "mgfile", ".", "info", ".", "bits_per_sample", "return", "0" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.channels
The number of channels in the audio (an int).
phrydy/mediafile.py
def channels(self): """The number of channels in the audio (an int).""" if hasattr(self.mgfile.info, 'channels'): return self.mgfile.info.channels return 0
def channels(self): """The number of channels in the audio (an int).""" if hasattr(self.mgfile.info, 'channels'): return self.mgfile.info.channels return 0
[ "The", "number", "of", "channels", "in", "the", "audio", "(", "an", "int", ")", "." ]
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2182-L2186
[ "def", "channels", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'channels'", ")", ":", "return", "self", ".", "mgfile", ".", "info", ".", "channels", "return", "0" ]
aa13755155977b4776e49f79984f9968ac1d74dc
train
MediaFile.bitrate
The number of bits per seconds used in the audio coding (an int). If this is provided explicitly by the compressed file format, this is a precise reflection of the encoding. Otherwise, it is estimated from the on-disk file size. In this case, some imprecision is possible because the file...
phrydy/mediafile.py
def bitrate(self): """The number of bits per seconds used in the audio coding (an int). If this is provided explicitly by the compressed file format, this is a precise reflection of the encoding. Otherwise, it is estimated from the on-disk file size. In this case, some imprecisio...
def bitrate(self): """The number of bits per seconds used in the audio coding (an int). If this is provided explicitly by the compressed file format, this is a precise reflection of the encoding. Otherwise, it is estimated from the on-disk file size. In this case, some imprecisio...
[ "The", "number", "of", "bits", "per", "seconds", "used", "in", "the", "audio", "coding", "(", "an", "int", ")", ".", "If", "this", "is", "provided", "explicitly", "by", "the", "compressed", "file", "format", "this", "is", "a", "precise", "reflection", "o...
Josef-Friedrich/phrydy
python
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2189-L2207
[ "def", "bitrate", "(", "self", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'bitrate'", ")", "and", "self", ".", "mgfile", ".", "info", ".", "bitrate", ":", "# Many formats provide it explicitly.", "return", "self", ".", "mgfil...
aa13755155977b4776e49f79984f9968ac1d74dc
train
fromfits
Reads a FITS file and returns a 2D numpy array of the data. Use hdu to specify which HDU you want (default = primary = 0)
bin/lib/Astro_Libraries/cosmics.py
def fromfits(infilename, hdu = 0, verbose = True): """ Reads a FITS file and returns a 2D numpy array of the data. Use hdu to specify which HDU you want (default = primary = 0) """ pixelarray, hdr = pyfits.getdata(infilename, hdu, header=True) pixelarray = np.asarray(pixelarray).transpose()...
def fromfits(infilename, hdu = 0, verbose = True): """ Reads a FITS file and returns a 2D numpy array of the data. Use hdu to specify which HDU you want (default = primary = 0) """ pixelarray, hdr = pyfits.getdata(infilename, hdu, header=True) pixelarray = np.asarray(pixelarray).transpose()...
[ "Reads", "a", "FITS", "file", "and", "returns", "a", "2D", "numpy", "array", "of", "the", "data", ".", "Use", "hdu", "to", "specify", "which", "HDU", "you", "want", "(", "default", "=", "primary", "=", "0", ")" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L639-L654
[ "def", "fromfits", "(", "infilename", ",", "hdu", "=", "0", ",", "verbose", "=", "True", ")", ":", "pixelarray", ",", "hdr", "=", "pyfits", ".", "getdata", "(", "infilename", ",", "hdu", ",", "header", "=", "True", ")", "pixelarray", "=", "np", ".", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
tofits
Takes a 2D numpy array and write it into a FITS file. If you specify a header (pyfits format, as returned by fromfits()) it will be used for the image. You can give me boolean numpy arrays, I will convert them into 8 bit integers.
bin/lib/Astro_Libraries/cosmics.py
def tofits(outfilename, pixelarray, hdr = None, verbose = True): """ Takes a 2D numpy array and write it into a FITS file. If you specify a header (pyfits format, as returned by fromfits()) it will be used for the image. You can give me boolean numpy arrays, I will convert them into 8 bit integers. ...
def tofits(outfilename, pixelarray, hdr = None, verbose = True): """ Takes a 2D numpy array and write it into a FITS file. If you specify a header (pyfits format, as returned by fromfits()) it will be used for the image. You can give me boolean numpy arrays, I will convert them into 8 bit integers. ...
[ "Takes", "a", "2D", "numpy", "array", "and", "write", "it", "into", "a", "FITS", "file", ".", "If", "you", "specify", "a", "header", "(", "pyfits", "format", "as", "returned", "by", "fromfits", "()", ")", "it", "will", "be", "used", "for", "the", "im...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L656-L680
[ "def", "tofits", "(", "outfilename", ",", "pixelarray", ",", "hdr", "=", "None", ",", "verbose", "=", "True", ")", ":", "pixelarrayshape", "=", "pixelarray", ".", "shape", "if", "verbose", ":", "print", "\"FITS export shape : (%i, %i)\"", "%", "(", "pixelarray...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
subsample
Returns a 2x2-subsampled version of array a (no interpolation, just cutting pixels in 4). The version below is directly from the scipy cookbook on rebinning : U{http://www.scipy.org/Cookbook/Rebinning} There is ndimage.zoom(cutout.array, 2, order=0, prefilter=False), but it makes funny borders.
bin/lib/Astro_Libraries/cosmics.py
def subsample(a): # this is more a generic function then a method ... """ Returns a 2x2-subsampled version of array a (no interpolation, just cutting pixels in 4). The version below is directly from the scipy cookbook on rebinning : U{http://www.scipy.org/Cookbook/Rebinning} There is ndimage.zoom(cu...
def subsample(a): # this is more a generic function then a method ... """ Returns a 2x2-subsampled version of array a (no interpolation, just cutting pixels in 4). The version below is directly from the scipy cookbook on rebinning : U{http://www.scipy.org/Cookbook/Rebinning} There is ndimage.zoom(cu...
[ "Returns", "a", "2x2", "-", "subsampled", "version", "of", "array", "a", "(", "no", "interpolation", "just", "cutting", "pixels", "in", "4", ")", ".", "The", "version", "below", "is", "directly", "from", "the", "scipy", "cookbook", "on", "rebinning", ":", ...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L685-L709
[ "def", "subsample", "(", "a", ")", ":", "# this is more a generic function then a method ...", "\"\"\"\n # Ouuwww this is slow ...\n outarray = np.zeros((a.shape[0]*2, a.shape[1]*2), dtype=np.float64)\n for i in range(a.shape[0]):\n for j in range(a.shape[1]): \n outarray...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
rebin2x2
Wrapper around rebin that actually rebins 2 by 2
bin/lib/Astro_Libraries/cosmics.py
def rebin2x2(a): """ Wrapper around rebin that actually rebins 2 by 2 """ inshape = np.array(a.shape) if not (inshape % 2 == np.zeros(2)).all(): # Modulo check to see if size is even raise RuntimeError, "I want even image shapes !" return rebin(a, inshape/2)
def rebin2x2(a): """ Wrapper around rebin that actually rebins 2 by 2 """ inshape = np.array(a.shape) if not (inshape % 2 == np.zeros(2)).all(): # Modulo check to see if size is even raise RuntimeError, "I want even image shapes !" return rebin(a, inshape/2)
[ "Wrapper", "around", "rebin", "that", "actually", "rebins", "2", "by", "2" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L734-L742
[ "def", "rebin2x2", "(", "a", ")", ":", "inshape", "=", "np", ".", "array", "(", "a", ".", "shape", ")", "if", "not", "(", "inshape", "%", "2", "==", "np", ".", "zeros", "(", "2", ")", ")", ".", "all", "(", ")", ":", "# Modulo check to see if size...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.labelmask
Finds and labels the cosmic "islands" and returns a list of dicts containing their positions. This is made on purpose for visualizations a la f2n.drawstarslist, but could be useful anyway.
bin/lib/Astro_Libraries/cosmics.py
def labelmask(self, verbose = None): """ Finds and labels the cosmic "islands" and returns a list of dicts containing their positions. This is made on purpose for visualizations a la f2n.drawstarslist, but could be useful anyway. """ if verbose == None: verbose = self...
def labelmask(self, verbose = None): """ Finds and labels the cosmic "islands" and returns a list of dicts containing their positions. This is made on purpose for visualizations a la f2n.drawstarslist, but could be useful anyway. """ if verbose == None: verbose = self...
[ "Finds", "and", "labels", "the", "cosmic", "islands", "and", "returns", "a", "list", "of", "dicts", "containing", "their", "positions", ".", "This", "is", "made", "on", "purpose", "for", "visualizations", "a", "la", "f2n", ".", "drawstarslist", "but", "could...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L154-L185
[ "def", "labelmask", "(", "self", ",", "verbose", "=", "None", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Labeling mask pixels ...\"", "# We morphologicaly dilate the mask to generously conn...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.getdilatedmask
Returns a morphologically dilated copy of the current mask. size = 3 or 5 decides how to dilate.
bin/lib/Astro_Libraries/cosmics.py
def getdilatedmask(self, size=3): """ Returns a morphologically dilated copy of the current mask. size = 3 or 5 decides how to dilate. """ if size == 3: dilmask = ndimage.morphology.binary_dilation(self.mask, structure=growkernel, iterations=1, mask=None, output=None,...
def getdilatedmask(self, size=3): """ Returns a morphologically dilated copy of the current mask. size = 3 or 5 decides how to dilate. """ if size == 3: dilmask = ndimage.morphology.binary_dilation(self.mask, structure=growkernel, iterations=1, mask=None, output=None,...
[ "Returns", "a", "morphologically", "dilated", "copy", "of", "the", "current", "mask", ".", "size", "=", "3", "or", "5", "decides", "how", "to", "dilate", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L188-L200
[ "def", "getdilatedmask", "(", "self", ",", "size", "=", "3", ")", ":", "if", "size", "==", "3", ":", "dilmask", "=", "ndimage", ".", "morphology", ".", "binary_dilation", "(", "self", ".", "mask", ",", "structure", "=", "growkernel", ",", "iterations", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.clean
Given the mask, we replace the actual problematic pixels with the masked 5x5 median value. This mimics what is done in L.A.Cosmic, but it's a bit harder to do in python, as there is no readymade masked median. So for now we do a loop... Saturated stars, if calculated, are also masked : they are ...
bin/lib/Astro_Libraries/cosmics.py
def clean(self, mask = None, verbose = None): """ Given the mask, we replace the actual problematic pixels with the masked 5x5 median value. This mimics what is done in L.A.Cosmic, but it's a bit harder to do in python, as there is no readymade masked median. So for now we do a loop... ...
def clean(self, mask = None, verbose = None): """ Given the mask, we replace the actual problematic pixels with the masked 5x5 median value. This mimics what is done in L.A.Cosmic, but it's a bit harder to do in python, as there is no readymade masked median. So for now we do a loop... ...
[ "Given", "the", "mask", "we", "replace", "the", "actual", "problematic", "pixels", "with", "the", "masked", "5x5", "median", "value", ".", "This", "mimics", "what", "is", "done", "in", "L", ".", "A", ".", "Cosmic", "but", "it", "s", "a", "bit", "harder...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L203-L294
[ "def", "clean", "(", "self", ",", "mask", "=", "None", ",", "verbose", "=", "None", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "mask", "==", "None", ":", "mask", "=", "self", ".", "mask", "if", "ve...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.findsatstars
Uses the satlevel to find saturated stars (not cosmics !), and puts the result as a mask in self.satstars. This can then be used to avoid these regions in cosmic detection and cleaning procedures. Slow ...
bin/lib/Astro_Libraries/cosmics.py
def findsatstars(self, verbose = None): """ Uses the satlevel to find saturated stars (not cosmics !), and puts the result as a mask in self.satstars. This can then be used to avoid these regions in cosmic detection and cleaning procedures. Slow ... """ if verbose == None...
def findsatstars(self, verbose = None): """ Uses the satlevel to find saturated stars (not cosmics !), and puts the result as a mask in self.satstars. This can then be used to avoid these regions in cosmic detection and cleaning procedures. Slow ... """ if verbose == None...
[ "Uses", "the", "satlevel", "to", "find", "saturated", "stars", "(", "not", "cosmics", "!", ")", "and", "puts", "the", "result", "as", "a", "mask", "in", "self", ".", "satstars", ".", "This", "can", "then", "be", "used", "to", "avoid", "these", "regions...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L296-L351
[ "def", "findsatstars", "(", "self", ",", "verbose", "=", "None", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Detecting saturated stars ...\"", "# DETECTION", "satpixels", "=", "self", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.getsatstars
Returns the mask of saturated stars after finding them if not yet done. Intended mainly for external use.
bin/lib/Astro_Libraries/cosmics.py
def getsatstars(self, verbose = None): """ Returns the mask of saturated stars after finding them if not yet done. Intended mainly for external use. """ if verbose == None: verbose = self.verbose if not self.satlevel > 0: raise RuntimeError, "Canno...
def getsatstars(self, verbose = None): """ Returns the mask of saturated stars after finding them if not yet done. Intended mainly for external use. """ if verbose == None: verbose = self.verbose if not self.satlevel > 0: raise RuntimeError, "Canno...
[ "Returns", "the", "mask", "of", "saturated", "stars", "after", "finding", "them", "if", "not", "yet", "done", ".", "Intended", "mainly", "for", "external", "use", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L353-L364
[ "def", "getsatstars", "(", "self", ",", "verbose", "=", "None", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "not", "self", ".", "satlevel", ">", "0", ":", "raise", "RuntimeError", ",", "\"Cannot determine s...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.guessbackgroundlevel
Estimates the background level. This could be used to fill pixels in large cosmics.
bin/lib/Astro_Libraries/cosmics.py
def guessbackgroundlevel(self): """ Estimates the background level. This could be used to fill pixels in large cosmics. """ if self.backgroundlevel == None: self.backgroundlevel = np.median(self.rawarray.ravel()) return self.backgroundlevel
def guessbackgroundlevel(self): """ Estimates the background level. This could be used to fill pixels in large cosmics. """ if self.backgroundlevel == None: self.backgroundlevel = np.median(self.rawarray.ravel()) return self.backgroundlevel
[ "Estimates", "the", "background", "level", ".", "This", "could", "be", "used", "to", "fill", "pixels", "in", "large", "cosmics", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L382-L388
[ "def", "guessbackgroundlevel", "(", "self", ")", ":", "if", "self", ".", "backgroundlevel", "==", "None", ":", "self", ".", "backgroundlevel", "=", "np", ".", "median", "(", "self", ".", "rawarray", ".", "ravel", "(", ")", ")", "return", "self", ".", "...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.lacosmiciteration
Performs one iteration of the L.A.Cosmic algorithm. It operates on self.cleanarray, and afterwards updates self.mask by adding the newly detected cosmics to the existing self.mask. Cleaning is not made automatically ! You have to call clean() after each iteration. This way you can run it...
bin/lib/Astro_Libraries/cosmics.py
def lacosmiciteration(self, verbose = None): """ Performs one iteration of the L.A.Cosmic algorithm. It operates on self.cleanarray, and afterwards updates self.mask by adding the newly detected cosmics to the existing self.mask. Cleaning is not made automatically ! You have to call ...
def lacosmiciteration(self, verbose = None): """ Performs one iteration of the L.A.Cosmic algorithm. It operates on self.cleanarray, and afterwards updates self.mask by adding the newly detected cosmics to the existing self.mask. Cleaning is not made automatically ! You have to call ...
[ "Performs", "one", "iteration", "of", "the", "L", ".", "A", ".", "Cosmic", "algorithm", ".", "It", "operates", "on", "self", ".", "cleanarray", "and", "afterwards", "updates", "self", ".", "mask", "by", "adding", "the", "newly", "detected", "cosmics", "to"...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L391-L531
[ "def", "lacosmiciteration", "(", "self", ",", "verbose", "=", "None", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Convolving image with Laplacian kernel ...\"", "# We subsample, convolve, cl...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
cosmicsimage.run
Full artillery :-) - Find saturated stars - Run maxiter L.A.Cosmic iterations (stops if no more cosmics are found) Stops if no cosmics are found or if maxiter is reached.
bin/lib/Astro_Libraries/cosmics.py
def run(self, maxiter = 4, verbose = False): """ Full artillery :-) - Find saturated stars - Run maxiter L.A.Cosmic iterations (stops if no more cosmics are found) Stops if no cosmics are found or if maxiter is reached. """ if self.satlev...
def run(self, maxiter = 4, verbose = False): """ Full artillery :-) - Find saturated stars - Run maxiter L.A.Cosmic iterations (stops if no more cosmics are found) Stops if no cosmics are found or if maxiter is reached. """ if self.satlev...
[ "Full", "artillery", ":", "-", ")", "-", "Find", "saturated", "stars", "-", "Run", "maxiter", "L", ".", "A", ".", "Cosmic", "iterations", "(", "stops", "if", "no", "more", "cosmics", "are", "found", ")", "Stops", "if", "no", "cosmics", "are", "found", ...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L591-L617
[ "def", "run", "(", "self", ",", "maxiter", "=", "4", ",", "verbose", "=", "False", ")", ":", "if", "self", ".", "satlevel", ">", "0", "and", "self", ".", "satstars", "==", "None", ":", "self", ".", "findsatstars", "(", "verbose", "=", "True", ")", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
MirageEnvironment.search_project_root
Search your Django project root. returns: - path:string Django project root path
mirage/proj/environ.py
def search_project_root(): """ Search your Django project root. returns: - path:string Django project root path """ while True: current = os.getcwd() if pathlib.Path("Miragefile.py").is_file() or pathlib.Path("Miragefile").is_file(): ...
def search_project_root(): """ Search your Django project root. returns: - path:string Django project root path """ while True: current = os.getcwd() if pathlib.Path("Miragefile.py").is_file() or pathlib.Path("Miragefile").is_file(): ...
[ "Search", "your", "Django", "project", "root", "." ]
shotastage/mirage-django-lts
python
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L61-L78
[ "def", "search_project_root", "(", ")", ":", "while", "True", ":", "current", "=", "os", ".", "getcwd", "(", ")", "if", "pathlib", ".", "Path", "(", "\"Miragefile.py\"", ")", ".", "is_file", "(", ")", "or", "pathlib", ".", "Path", "(", "\"Miragefile\"", ...
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
train
MirageEnvironment.search_app_root
Search your Django application root returns: - (String) Django application root path
mirage/proj/environ.py
def search_app_root(): """ Search your Django application root returns: - (String) Django application root path """ while True: current = os.getcwd() if pathlib.Path("apps.py").is_file(): return current elif pathl...
def search_app_root(): """ Search your Django application root returns: - (String) Django application root path """ while True: current = os.getcwd() if pathlib.Path("apps.py").is_file(): return current elif pathl...
[ "Search", "your", "Django", "application", "root" ]
shotastage/mirage-django-lts
python
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L81-L97
[ "def", "search_app_root", "(", ")", ":", "while", "True", ":", "current", "=", "os", ".", "getcwd", "(", ")", "if", "pathlib", ".", "Path", "(", "\"apps.py\"", ")", ".", "is_file", "(", ")", ":", "return", "current", "elif", "pathlib", ".", "Path", "...
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
train
MirageEnvironment.in_app
Judge where current working directory is in Django application or not. returns: - (Bool) cwd is in app dir returns True
mirage/proj/environ.py
def in_app() -> bool: """ Judge where current working directory is in Django application or not. returns: - (Bool) cwd is in app dir returns True """ try: MirageEnvironment.set_import_root() import apps if os.path.isfile("apps.py")...
def in_app() -> bool: """ Judge where current working directory is in Django application or not. returns: - (Bool) cwd is in app dir returns True """ try: MirageEnvironment.set_import_root() import apps if os.path.isfile("apps.py")...
[ "Judge", "where", "current", "working", "directory", "is", "in", "Django", "application", "or", "not", "." ]
shotastage/mirage-django-lts
python
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L137-L154
[ "def", "in_app", "(", ")", "->", "bool", ":", "try", ":", "MirageEnvironment", ".", "set_import_root", "(", ")", "import", "apps", "if", "os", ".", "path", ".", "isfile", "(", "\"apps.py\"", ")", ":", "return", "True", "else", ":", "return", "False", "...
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
train
update_cached_fields
Calls update_cached_fields() for each object passed in as argument. Supports also iterable objects by checking __iter__ attribute. :param args: List of objects :return: None
jutil/cache.py
def update_cached_fields(*args): """ Calls update_cached_fields() for each object passed in as argument. Supports also iterable objects by checking __iter__ attribute. :param args: List of objects :return: None """ for a in args: if a is not None: if hasattr(a, '__iter__'...
def update_cached_fields(*args): """ Calls update_cached_fields() for each object passed in as argument. Supports also iterable objects by checking __iter__ attribute. :param args: List of objects :return: None """ for a in args: if a is not None: if hasattr(a, '__iter__'...
[ "Calls", "update_cached_fields", "()", "for", "each", "object", "passed", "in", "as", "argument", ".", "Supports", "also", "iterable", "objects", "by", "checking", "__iter__", "attribute", ".", ":", "param", "args", ":", "List", "of", "objects", ":", "return",...
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/cache.py#L49-L62
[ "def", "update_cached_fields", "(", "*", "args", ")", ":", "for", "a", "in", "args", ":", "if", "a", "is", "not", "None", ":", "if", "hasattr", "(", "a", ",", "'__iter__'", ")", ":", "for", "e", "in", "a", ":", "e", ".", "update_cached_fields", "("...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
CachedFieldsMixin.update_cached_fields_pre_save
Call on pre_save signal for objects (to automatically refresh on save). :param update_fields: list of fields to update
jutil/cache.py
def update_cached_fields_pre_save(self, update_fields: list): """ Call on pre_save signal for objects (to automatically refresh on save). :param update_fields: list of fields to update """ if self.id and update_fields is None: self.update_cached_fields(commit=False, e...
def update_cached_fields_pre_save(self, update_fields: list): """ Call on pre_save signal for objects (to automatically refresh on save). :param update_fields: list of fields to update """ if self.id and update_fields is None: self.update_cached_fields(commit=False, e...
[ "Call", "on", "pre_save", "signal", "for", "objects", "(", "to", "automatically", "refresh", "on", "save", ")", ".", ":", "param", "update_fields", ":", "list", "of", "fields", "to", "update" ]
kajala/django-jutil
python
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/cache.py#L40-L46
[ "def", "update_cached_fields_pre_save", "(", "self", ",", "update_fields", ":", "list", ")", ":", "if", "self", ".", "id", "and", "update_fields", "is", "None", ":", "self", ".", "update_cached_fields", "(", "commit", "=", "False", ",", "exceptions", "=", "F...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
train
start
Start working on a new hotfix. This will create a new branch off master called hotfix/<name>. Args: name (str): The name of the new feature.
src/peltak/extra/gitflow/logic/hotfix.py
def start(name): # type: (str) -> None """ Start working on a new hotfix. This will create a new branch off master called hotfix/<name>. Args: name (str): The name of the new feature. """ hotfix_branch = 'hotfix/' + common.to_branch_name(name) master = conf.get('git.mas...
def start(name): # type: (str) -> None """ Start working on a new hotfix. This will create a new branch off master called hotfix/<name>. Args: name (str): The name of the new feature. """ hotfix_branch = 'hotfix/' + common.to_branch_name(name) master = conf.get('git.mas...
[ "Start", "working", "on", "a", "new", "hotfix", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L30-L44
[ "def", "start", "(", "name", ")", ":", "# type: (str) -> None", "hotfix_branch", "=", "'hotfix/'", "+", "common", ".", "to_branch_name", "(", "name", ")", "master", "=", "conf", ".", "get", "(", "'git.master_branch'", ",", "'master'", ")", "common", ".", "as...
b627acc019e3665875fe76cdca0a14773b69beaa
train
finish
Merge current feature into develop.
src/peltak/extra/gitflow/logic/hotfix.py
def finish(): # type: () -> None """ Merge current feature into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you merge the ...
def finish(): # type: () -> None """ Merge current feature into develop. """ pretend = context.get('pretend', False) if not pretend and (git.staged() or git.unstaged()): log.err( "You have uncommitted changes in your repo!\n" "You need to stash them before you merge the ...
[ "Merge", "current", "feature", "into", "develop", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L76-L108
[ "def", "finish", "(", ")", ":", "# type: () -> None", "pretend", "=", "context", ".", "get", "(", "'pretend'", ",", "False", ")", "if", "not", "pretend", "and", "(", "git", ".", "staged", "(", ")", "or", "git", ".", "unstaged", "(", ")", ")", ":", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
merged
Cleanup a remotely merged branch.
src/peltak/extra/gitflow/logic/hotfix.py
def merged(): # type: () -> None """ Cleanup a remotely merged branch. """ develop = conf.get('git.devel_branch', 'develop') master = conf.get('git.master_branch', 'master') branch = git.current_branch(refresh=True) common.assert_branch_type('hotfix') # Pull master with the merged hotfix ...
def merged(): # type: () -> None """ Cleanup a remotely merged branch. """ develop = conf.get('git.devel_branch', 'develop') master = conf.get('git.master_branch', 'master') branch = git.current_branch(refresh=True) common.assert_branch_type('hotfix') # Pull master with the merged hotfix ...
[ "Cleanup", "a", "remotely", "merged", "branch", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L111-L133
[ "def", "merged", "(", ")", ":", "# type: () -> None", "develop", "=", "conf", ".", "get", "(", "'git.devel_branch'", ",", "'develop'", ")", "master", "=", "conf", ".", "get", "(", "'git.master_branch'", ",", "'master'", ")", "branch", "=", "git", ".", "cur...
b627acc019e3665875fe76cdca0a14773b69beaa
train
ShellCommand.run
Run the shell command Returns: ShellCommand: return this ShellCommand instance for chaining
chuda/shell.py
def run(self): """ Run the shell command Returns: ShellCommand: return this ShellCommand instance for chaining """ if not self.block: self.output = [] self.error = [] self.thread = threading.Thread(target=self.run_non_blocking) ...
def run(self): """ Run the shell command Returns: ShellCommand: return this ShellCommand instance for chaining """ if not self.block: self.output = [] self.error = [] self.thread = threading.Thread(target=self.run_non_blocking) ...
[ "Run", "the", "shell", "command" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L51-L72
[ "def", "run", "(", "self", ")", ":", "if", "not", "self", ".", "block", ":", "self", ".", "output", "=", "[", "]", "self", ".", "error", "=", "[", "]", "self", ".", "thread", "=", "threading", ".", "Thread", "(", "target", "=", "self", ".", "ru...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.send
Send text to stdin. Can only be used on non blocking commands Args: value (str): the text to write on stdin Raises: TypeError: If command is blocking Returns: ShellCommand: return this ShellCommand instance for chaining
chuda/shell.py
def send(self, value): """ Send text to stdin. Can only be used on non blocking commands Args: value (str): the text to write on stdin Raises: TypeError: If command is blocking Returns: ShellCommand: return this ShellCommand instance for chain...
def send(self, value): """ Send text to stdin. Can only be used on non blocking commands Args: value (str): the text to write on stdin Raises: TypeError: If command is blocking Returns: ShellCommand: return this ShellCommand instance for chain...
[ "Send", "text", "to", "stdin", ".", "Can", "only", "be", "used", "on", "non", "blocking", "commands" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L114-L129
[ "def", "send", "(", "self", ",", "value", ")", ":", "if", "not", "self", ".", "block", "and", "self", ".", "_stdin", "is", "not", "None", ":", "self", ".", "writer", ".", "write", "(", "\"{}\\n\"", ".", "format", "(", "value", ")", ")", "return", ...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.poll_output
Append lines from stdout to self.output. Returns: list: The lines added since last call
chuda/shell.py
def poll_output(self): """ Append lines from stdout to self.output. Returns: list: The lines added since last call """ if self.block: return self.output new_list = self.output[self.old_output_size:] self.old_output_size += len(new_list) ...
def poll_output(self): """ Append lines from stdout to self.output. Returns: list: The lines added since last call """ if self.block: return self.output new_list = self.output[self.old_output_size:] self.old_output_size += len(new_list) ...
[ "Append", "lines", "from", "stdout", "to", "self", ".", "output", "." ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L131-L143
[ "def", "poll_output", "(", "self", ")", ":", "if", "self", ".", "block", ":", "return", "self", ".", "output", "new_list", "=", "self", ".", "output", "[", "self", ".", "old_output_size", ":", "]", "self", ".", "old_output_size", "+=", "len", "(", "new...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.poll_error
Append lines from stderr to self.errors. Returns: list: The lines added since last call
chuda/shell.py
def poll_error(self): """ Append lines from stderr to self.errors. Returns: list: The lines added since last call """ if self.block: return self.error new_list = self.error[self.old_error_size:] self.old_error_size += len(new_list) ...
def poll_error(self): """ Append lines from stderr to self.errors. Returns: list: The lines added since last call """ if self.block: return self.error new_list = self.error[self.old_error_size:] self.old_error_size += len(new_list) ...
[ "Append", "lines", "from", "stderr", "to", "self", ".", "errors", "." ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L145-L157
[ "def", "poll_error", "(", "self", ")", ":", "if", "self", ".", "block", ":", "return", "self", ".", "error", "new_list", "=", "self", ".", "error", "[", "self", ".", "old_error_size", ":", "]", "self", ".", "old_error_size", "+=", "len", "(", "new_list...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.kill
Kill the current non blocking command Raises: TypeError: If command is blocking
chuda/shell.py
def kill(self): """ Kill the current non blocking command Raises: TypeError: If command is blocking """ if self.block: raise TypeError(NON_BLOCKING_ERROR_MESSAGE) try: self.process.kill() except ProcessLookupError as exc: ...
def kill(self): """ Kill the current non blocking command Raises: TypeError: If command is blocking """ if self.block: raise TypeError(NON_BLOCKING_ERROR_MESSAGE) try: self.process.kill() except ProcessLookupError as exc: ...
[ "Kill", "the", "current", "non", "blocking", "command" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L159-L172
[ "def", "kill", "(", "self", ")", ":", "if", "self", ".", "block", ":", "raise", "TypeError", "(", "NON_BLOCKING_ERROR_MESSAGE", ")", "try", ":", "self", ".", "process", ".", "kill", "(", ")", "except", "ProcessLookupError", "as", "exc", ":", "self", ".",...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.wait_for
Block until a pattern have been found in stdout and stderr Args: pattern(:class:`~re.Pattern`): The pattern to search timeout(int): Maximum number of second to wait. If None, wait infinitely Raises: TimeoutError: When timeout is reach
chuda/shell.py
def wait_for(self, pattern, timeout=None): """ Block until a pattern have been found in stdout and stderr Args: pattern(:class:`~re.Pattern`): The pattern to search timeout(int): Maximum number of second to wait. If None, wait infinitely Raises: Tim...
def wait_for(self, pattern, timeout=None): """ Block until a pattern have been found in stdout and stderr Args: pattern(:class:`~re.Pattern`): The pattern to search timeout(int): Maximum number of second to wait. If None, wait infinitely Raises: Tim...
[ "Block", "until", "a", "pattern", "have", "been", "found", "in", "stdout", "and", "stderr" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L174-L203
[ "def", "wait_for", "(", "self", ",", "pattern", ",", "timeout", "=", "None", ")", ":", "should_continue", "=", "True", "if", "self", ".", "block", ":", "raise", "TypeError", "(", "NON_BLOCKING_ERROR_MESSAGE", ")", "def", "stop", "(", "signum", ",", "frame"...
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.is_running
Check if the command is currently running Returns: bool: True if running, else False
chuda/shell.py
def is_running(self): """ Check if the command is currently running Returns: bool: True if running, else False """ if self.block: return False return self.thread.is_alive() or self.process.poll() is None
def is_running(self): """ Check if the command is currently running Returns: bool: True if running, else False """ if self.block: return False return self.thread.is_alive() or self.process.poll() is None
[ "Check", "if", "the", "command", "is", "currently", "running" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L205-L215
[ "def", "is_running", "(", "self", ")", ":", "if", "self", ".", "block", ":", "return", "False", "return", "self", ".", "thread", ".", "is_alive", "(", ")", "or", "self", ".", "process", ".", "poll", "(", ")", "is", "None" ]
0d93b716dede35231c21be97bcc19a656655983f
train
ShellCommand.print_live_output
Block and print the output of the command Raises: TypeError: If command is blocking
chuda/shell.py
def print_live_output(self): ''' Block and print the output of the command Raises: TypeError: If command is blocking ''' if self.block: raise TypeError(NON_BLOCKING_ERROR_MESSAGE) else: while self.thread.is_alive() or self.old_output_s...
def print_live_output(self): ''' Block and print the output of the command Raises: TypeError: If command is blocking ''' if self.block: raise TypeError(NON_BLOCKING_ERROR_MESSAGE) else: while self.thread.is_alive() or self.old_output_s...
[ "Block", "and", "print", "the", "output", "of", "the", "command" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L224-L243
[ "def", "print_live_output", "(", "self", ")", ":", "if", "self", ".", "block", ":", "raise", "TypeError", "(", "NON_BLOCKING_ERROR_MESSAGE", ")", "else", ":", "while", "self", ".", "thread", ".", "is_alive", "(", ")", "or", "self", ".", "old_output_size", ...
0d93b716dede35231c21be97bcc19a656655983f
train
Runner.run
Create an instance of :class:`~ShellCommand` and run it Args: command (str): :class:`~ShellCommand` block (bool): See :class:`~ShellCommand` cwd (str): Override the runner cwd. Useb by the :class:`~ShellCommand` instance
chuda/shell.py
def run(self, command, block=True, cwd=None, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE): """ Create an instance of :class:`~ShellCommand` and run it Args: command (str): :class:`~ShellCommand` block (bool): See :class:`~ShellCommand` ...
def run(self, command, block=True, cwd=None, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE): """ Create an instance of :class:`~ShellCommand` and run it Args: command (str): :class:`~ShellCommand` block (bool): See :class:`~ShellCommand` ...
[ "Create", "an", "instance", "of", ":", "class", ":", "~ShellCommand", "and", "run", "it" ]
Varkal/chuda
python
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/shell.py#L259-L271
[ "def", "run", "(", "self", ",", "command", ",", "block", "=", "True", ",", "cwd", "=", "None", ",", "stdin", "=", "subprocess", ".", "PIPE", ",", "stdout", "=", "subprocess", ".", "PIPE", ",", "stderr", "=", "subprocess", ".", "PIPE", ")", ":", "if...
0d93b716dede35231c21be97bcc19a656655983f
train
bces
Bivariate, Correlated Errors and intrinsic Scatter (BCES) translated from the FORTRAN code by Christina Bird and Matthew Bershady (Akritas & Bershady, 1996) Linear regression in the presence of heteroscedastic errors on both variables and intrinsic scatter Parameters ---------- x1 ...
bin/lib/Math_Libraries/lnr_script.py
def bces(x1, x2, x1err=[], x2err=[], cerr=[], logify=True, model='yx', \ bootstrap=5000, verbose='normal', full_output=True): """ Bivariate, Correlated Errors and intrinsic Scatter (BCES) translated from the FORTRAN code by Christina Bird and Matthew Bershady (Akritas & Bershady, 1996) Lin...
def bces(x1, x2, x1err=[], x2err=[], cerr=[], logify=True, model='yx', \ bootstrap=5000, verbose='normal', full_output=True): """ Bivariate, Correlated Errors and intrinsic Scatter (BCES) translated from the FORTRAN code by Christina Bird and Matthew Bershady (Akritas & Bershady, 1996) Lin...
[ "Bivariate", "Correlated", "Errors", "and", "intrinsic", "Scatter", "(", "BCES", ")", "translated", "from", "the", "FORTRAN", "code", "by", "Christina", "Bird", "and", "Matthew", "Bershady", "(", "Akritas", "&", "Bershady", "1996", ")" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L12-L309
[ "def", "bces", "(", "x1", ",", "x2", ",", "x1err", "=", "[", "]", ",", "x2err", "=", "[", "]", ",", "cerr", "=", "[", "]", ",", "logify", "=", "True", ",", "model", "=", "'yx'", ",", "bootstrap", "=", "5000", ",", "verbose", "=", "'normal'", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
scatter
Used mainly to measure scatter for the BCES best-fit
bin/lib/Math_Libraries/lnr_script.py
def scatter(slope, zero, x1, x2, x1err=[], x2err=[]): """ Used mainly to measure scatter for the BCES best-fit """ n = len(x1) x2pred = zero + slope * x1 s = sum((x2 - x2pred) ** 2) / (n - 1) if len(x2err) == n: s_obs = sum((x2err / x2) ** 2) / n s0 = s - s_obs print num...
def scatter(slope, zero, x1, x2, x1err=[], x2err=[]): """ Used mainly to measure scatter for the BCES best-fit """ n = len(x1) x2pred = zero + slope * x1 s = sum((x2 - x2pred) ** 2) / (n - 1) if len(x2err) == n: s_obs = sum((x2err / x2) ** 2) / n s0 = s - s_obs print num...
[ "Used", "mainly", "to", "measure", "scatter", "for", "the", "BCES", "best", "-", "fit" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L311-L323
[ "def", "scatter", "(", "slope", ",", "zero", ",", "x1", ",", "x2", ",", "x1err", "=", "[", "]", ",", "x2err", "=", "[", "]", ")", ":", "n", "=", "len", "(", "x1", ")", "x2pred", "=", "zero", "+", "slope", "*", "x1", "s", "=", "sum", "(", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
kelly
Python wrapper for the linear regression MCMC of Kelly (2007). Requires pidly (http://astronomy.sussex.ac.uk/~anthonys/pidly/) and an IDL license. Parameters ---------- x1 : array of floats Independent variable, or observable x2 : array of floats ...
bin/lib/Math_Libraries/lnr_script.py
def kelly(x1, x2, x1err=[], x2err=[], cerr=[], logify=True, miniter=5000, maxiter=1e5, metro=True, silent=True): """ Python wrapper for the linear regression MCMC of Kelly (2007). Requires pidly (http://astronomy.sussex.ac.uk/~anthonys/pidly/) and an IDL license. Parameters ...
def kelly(x1, x2, x1err=[], x2err=[], cerr=[], logify=True, miniter=5000, maxiter=1e5, metro=True, silent=True): """ Python wrapper for the linear regression MCMC of Kelly (2007). Requires pidly (http://astronomy.sussex.ac.uk/~anthonys/pidly/) and an IDL license. Parameters ...
[ "Python", "wrapper", "for", "the", "linear", "regression", "MCMC", "of", "Kelly", "(", "2007", ")", ".", "Requires", "pidly", "(", "http", ":", "//", "astronomy", ".", "sussex", ".", "ac", ".", "uk", "/", "~anthonys", "/", "pidly", "/", ")", "and", "...
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L325-L380
[ "def", "kelly", "(", "x1", ",", "x2", ",", "x1err", "=", "[", "]", ",", "x2err", "=", "[", "]", ",", "cerr", "=", "[", "]", ",", "logify", "=", "True", ",", "miniter", "=", "5000", ",", "maxiter", "=", "1e5", ",", "metro", "=", "True", ",", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
mcmc
Use emcee to find the best-fit linear relation or power law accounting for measurement uncertainties and intrinsic scatter Parameters ---------- x1 : array of floats Independent variable, or observable x2 : array of floats Dependent variable ...
bin/lib/Math_Libraries/lnr_script.py
def mcmc(x1, x2, x1err=[], x2err=[], po=(1,1,0.5), logify=True, nsteps=5000, nwalkers=100, nburn=500, output='full'): """ Use emcee to find the best-fit linear relation or power law accounting for measurement uncertainties and intrinsic scatter Parameters ---------- x1 : array...
def mcmc(x1, x2, x1err=[], x2err=[], po=(1,1,0.5), logify=True, nsteps=5000, nwalkers=100, nburn=500, output='full'): """ Use emcee to find the best-fit linear relation or power law accounting for measurement uncertainties and intrinsic scatter Parameters ---------- x1 : array...
[ "Use", "emcee", "to", "find", "the", "best", "-", "fit", "linear", "relation", "or", "power", "law", "accounting", "for", "measurement", "uncertainties", "and", "intrinsic", "scatter" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L382-L468
[ "def", "mcmc", "(", "x1", ",", "x2", ",", "x1err", "=", "[", "]", ",", "x2err", "=", "[", "]", ",", "po", "=", "(", "1", ",", "1", ",", "0.5", ")", ",", "logify", "=", "True", ",", "nsteps", "=", "5000", ",", "nwalkers", "=", "100", ",", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
mle
Maximum Likelihood Estimation of best-fit parameters Parameters ---------- x1, x2 : float arrays the independent and dependent variables. x1err, x2err : float arrays (optional) measurement uncertainties on independent and dependent variables....
bin/lib/Math_Libraries/lnr_script.py
def mle(x1, x2, x1err=[], x2err=[], cerr=[], s_int=True, po=(1,0,0.1), verbose=False, logify=True, full_output=False): """ Maximum Likelihood Estimation of best-fit parameters Parameters ---------- x1, x2 : float arrays the independent and dependent variables. x...
def mle(x1, x2, x1err=[], x2err=[], cerr=[], s_int=True, po=(1,0,0.1), verbose=False, logify=True, full_output=False): """ Maximum Likelihood Estimation of best-fit parameters Parameters ---------- x1, x2 : float arrays the independent and dependent variables. x...
[ "Maximum", "Likelihood", "Estimation", "of", "best", "-", "fit", "parameters" ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L470-L535
[ "def", "mle", "(", "x1", ",", "x2", ",", "x1err", "=", "[", "]", ",", "x2err", "=", "[", "]", ",", "cerr", "=", "[", "]", ",", "s_int", "=", "True", ",", "po", "=", "(", "1", ",", "0", ",", "0.1", ")", ",", "verbose", "=", "False", ",", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
to_log
Take linear measurements and uncertainties and transform to log values.
bin/lib/Math_Libraries/lnr_script.py
def to_log(x1, x2, x1err, x2err): """ Take linear measurements and uncertainties and transform to log values. """ logx1 = numpy.log10(numpy.array(x1)) logx2 = numpy.log10(numpy.array(x2)) x1err = numpy.log10(numpy.array(x1)+numpy.array(x1err)) - logx1 x2err = numpy.log10(numpy.array(x2)+num...
def to_log(x1, x2, x1err, x2err): """ Take linear measurements and uncertainties and transform to log values. """ logx1 = numpy.log10(numpy.array(x1)) logx2 = numpy.log10(numpy.array(x2)) x1err = numpy.log10(numpy.array(x1)+numpy.array(x1err)) - logx1 x2err = numpy.log10(numpy.array(x2)+num...
[ "Take", "linear", "measurements", "and", "uncertainties", "and", "transform", "to", "log", "values", "." ]
Vital-Fernandez/dazer
python
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Math_Libraries/lnr_script.py#L537-L546
[ "def", "to_log", "(", "x1", ",", "x2", ",", "x1err", ",", "x2err", ")", ":", "logx1", "=", "numpy", ".", "log10", "(", "numpy", ".", "array", "(", "x1", ")", ")", "logx2", "=", "numpy", ".", "log10", "(", "numpy", ".", "array", "(", "x2", ")", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
train
wrap_paths
Put quotes around all paths and join them with space in-between.
src/peltak/core/fs.py
def wrap_paths(paths): # type: (list[str]) -> str """ Put quotes around all paths and join them with space in-between. """ if isinstance(paths, string_types): raise ValueError( "paths cannot be a string. " "Use array with one element instead." ) return ' '.join('"...
def wrap_paths(paths): # type: (list[str]) -> str """ Put quotes around all paths and join them with space in-between. """ if isinstance(paths, string_types): raise ValueError( "paths cannot be a string. " "Use array with one element instead." ) return ' '.join('"...
[ "Put", "quotes", "around", "all", "paths", "and", "join", "them", "with", "space", "in", "-", "between", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/fs.py#L32-L40
[ "def", "wrap_paths", "(", "paths", ")", ":", "# type: (list[str]) -> str", "if", "isinstance", "(", "paths", ",", "string_types", ")", ":", "raise", "ValueError", "(", "\"paths cannot be a string. \"", "\"Use array with one element instead.\"", ")", "return", "' '", "."...
b627acc019e3665875fe76cdca0a14773b69beaa
train
filtered_walk
Walk recursively starting at *path* excluding files matching *exclude* Args: path (str): A starting path. This has to be an existing directory. include (list[str]): A white list of glob patterns. If given, only files that match those globs will be yielded (filter...
src/peltak/core/fs.py
def filtered_walk(path, include=None, exclude=None): # type: (str, List[str], List[str]) -> Generator[str] """ Walk recursively starting at *path* excluding files matching *exclude* Args: path (str): A starting path. This has to be an existing directory. include (list[str]): ...
def filtered_walk(path, include=None, exclude=None): # type: (str, List[str], List[str]) -> Generator[str] """ Walk recursively starting at *path* excluding files matching *exclude* Args: path (str): A starting path. This has to be an existing directory. include (list[str]): ...
[ "Walk", "recursively", "starting", "at", "*", "path", "*", "excluding", "files", "matching", "*", "exclude", "*" ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/fs.py#L43-L82
[ "def", "filtered_walk", "(", "path", ",", "include", "=", "None", ",", "exclude", "=", "None", ")", ":", "# type: (str, List[str], List[str]) -> Generator[str]", "exclude", "=", "exclude", "or", "[", "]", "if", "not", "isdir", "(", "path", ")", ":", "raise", ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
match_globs
Test whether the given *path* matches any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path* matches any of those patters, it will return True. Returns: ...
src/peltak/core/fs.py
def match_globs(path, patterns): # type: (str, List[str]) -> bool """ Test whether the given *path* matches any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path* m...
def match_globs(path, patterns): # type: (str, List[str]) -> bool """ Test whether the given *path* matches any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path* m...
[ "Test", "whether", "the", "given", "*", "path", "*", "matches", "any", "patterns", "in", "*", "patterns", "*" ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/fs.py#L85-L113
[ "def", "match_globs", "(", "path", ",", "patterns", ")", ":", "# type: (str, List[str]) -> bool", "for", "pattern", "in", "(", "p", "for", "p", "in", "patterns", "if", "p", ")", ":", "if", "pattern", ".", "startswith", "(", "'/'", ")", ":", "regex", "=",...
b627acc019e3665875fe76cdca0a14773b69beaa
train
search_globs
Test whether the given *path* contains any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path* matches any of those patters, it will return True. Returns: ...
src/peltak/core/fs.py
def search_globs(path, patterns): # type: (str, List[str]) -> bool """ Test whether the given *path* contains any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path*...
def search_globs(path, patterns): # type: (str, List[str]) -> bool """ Test whether the given *path* contains any patterns in *patterns* Args: path (str): A file path to test for matches. patterns (list[str]): A list of glob string patterns to test against. If *path*...
[ "Test", "whether", "the", "given", "*", "path", "*", "contains", "any", "patterns", "in", "*", "patterns", "*" ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/fs.py#L116-L149
[ "def", "search_globs", "(", "path", ",", "patterns", ")", ":", "# type: (str, List[str]) -> bool", "for", "pattern", "in", "(", "p", "for", "p", "in", "patterns", "if", "p", ")", ":", "if", "pattern", ".", "startswith", "(", "'/'", ")", ":", "# If pattern ...
b627acc019e3665875fe76cdca0a14773b69beaa
train
write_file
--pretend aware file writing. You can always write files manually but you should always handle the --pretend case. Args: path (str): content (str): mode (str):
src/peltak/core/fs.py
def write_file(path, content, mode='w'): # type: (Text, Union[Text,bytes], Text) -> None """ --pretend aware file writing. You can always write files manually but you should always handle the --pretend case. Args: path (str): content (str): mode (str): """ from pelt...
def write_file(path, content, mode='w'): # type: (Text, Union[Text,bytes], Text) -> None """ --pretend aware file writing. You can always write files manually but you should always handle the --pretend case. Args: path (str): content (str): mode (str): """ from pelt...
[ "--", "pretend", "aware", "file", "writing", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/fs.py#L152-L173
[ "def", "write_file", "(", "path", ",", "content", ",", "mode", "=", "'w'", ")", ":", "# type: (Text, Union[Text,bytes], Text) -> None", "from", "peltak", ".", "core", "import", "context", "from", "peltak", ".", "core", "import", "log", "if", "context", ".", "g...
b627acc019e3665875fe76cdca0a14773b69beaa
train
lint_cli
Run pep8 and pylint on all project files. You can configure the linting paths using the lint.paths config variable. This should be a list of paths that will be linted. If a path to a directory is given, all files in that directory and it's subdirectories will be used. The pep8 and pylint config pa...
src/peltak/commands/lint.py
def lint_cli(ctx, exclude, skip_untracked, commit_only): # type: (click.Context, List[str], bool, bool) -> None """ Run pep8 and pylint on all project files. You can configure the linting paths using the lint.paths config variable. This should be a list of paths that will be linted. If a path to a dire...
def lint_cli(ctx, exclude, skip_untracked, commit_only): # type: (click.Context, List[str], bool, bool) -> None """ Run pep8 and pylint on all project files. You can configure the linting paths using the lint.paths config variable. This should be a list of paths that will be linted. If a path to a dire...
[ "Run", "pep8", "and", "pylint", "on", "all", "project", "files", "." ]
novopl/peltak
python
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/commands/lint.py#L54-L90
[ "def", "lint_cli", "(", "ctx", ",", "exclude", ",", "skip_untracked", ",", "commit_only", ")", ":", "# type: (click.Context, List[str], bool, bool) -> None", "if", "ctx", ".", "invoked_subcommand", ":", "return", "from", "peltak", ".", "logic", "import", "lint", "li...
b627acc019e3665875fe76cdca0a14773b69beaa
train
run_command
Runs a command using the subprocess module :param command: List containing the command and all args :param timeout_sec (float) seconds to wait before killing the command. :param output (bool) True collects output, False ignores output :return: Dict containing the command output and return code ...
pycons3rt/bash.py
def run_command(command, timeout_sec=3600.0, output=True): """Runs a command using the subprocess module :param command: List containing the command and all args :param timeout_sec (float) seconds to wait before killing the command. :param output (bool) True collects output, False ignores outpu...
def run_command(command, timeout_sec=3600.0, output=True): """Runs a command using the subprocess module :param command: List containing the command and all args :param timeout_sec (float) seconds to wait before killing the command. :param output (bool) True collects output, False ignores outpu...
[ "Runs", "a", "command", "using", "the", "subprocess", "module" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/bash.py#L67-L158
[ "def", "run_command", "(", "command", ",", "timeout_sec", "=", "3600.0", ",", "output", "=", "True", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.run_command'", ")", "if", "not", "isinstance", "(", "command", ",", "list", ...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d
train
get_ip_addresses
Gets the ip addresses from ifconfig :return: (dict) of devices and aliases with the IPv4 address
pycons3rt/bash.py
def get_ip_addresses(): """Gets the ip addresses from ifconfig :return: (dict) of devices and aliases with the IPv4 address """ log = logging.getLogger(mod_logger + '.get_ip_addresses') command = ['/sbin/ifconfig'] try: result = run_command(command) except CommandError: rai...
def get_ip_addresses(): """Gets the ip addresses from ifconfig :return: (dict) of devices and aliases with the IPv4 address """ log = logging.getLogger(mod_logger + '.get_ip_addresses') command = ['/sbin/ifconfig'] try: result = run_command(command) except CommandError: rai...
[ "Gets", "the", "ip", "addresses", "from", "ifconfig" ]
cons3rt/pycons3rt
python
https://github.com/cons3rt/pycons3rt/blob/f004ab3a35c5bff2f698131fef3b2a8ed5a7596d/pycons3rt/bash.py#L235-L267
[ "def", "get_ip_addresses", "(", ")", ":", "log", "=", "logging", ".", "getLogger", "(", "mod_logger", "+", "'.get_ip_addresses'", ")", "command", "=", "[", "'/sbin/ifconfig'", "]", "try", ":", "result", "=", "run_command", "(", "command", ")", "except", "Com...
f004ab3a35c5bff2f698131fef3b2a8ed5a7596d