repo
stringlengths
7
55
path
stringlengths
4
223
func_name
stringlengths
1
134
original_string
stringlengths
75
104k
language
stringclasses
1 value
code
stringlengths
75
104k
code_tokens
listlengths
19
28.4k
docstring
stringlengths
1
46.9k
docstring_tokens
listlengths
1
1.97k
sha
stringlengths
40
40
url
stringlengths
87
315
partition
stringclasses
1 value
nathankw/pulsarpy
pulsarpy/models.py
Library.post
def post(cls, payload): """ A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus ...
python
def post(cls, payload): """ A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus ...
[ "def", "post", "(", "cls", ",", "payload", ")", ":", "slpk_attr_name", "=", "\"sequencing_library_prep_kit_id\"", "paired_bc_id_attr_name", "=", "\"paired_barcode_id\"", "seq_reg", "=", "re", ".", "compile", "(", "\"^[ACGTN]+$\"", ")", "if", "paired_bc_id_attr_name", ...
A wrapper over Model.post() that handles the case where a Library has a PairedBarcode and the user may have supplied the PairedBarcode in the form of index1-index2, i.e. GATTTCCA-GGCGTCGA. This isn't the PairedBarcode's record name or a record ID, thus Model.post() won't be able to figure out ...
[ "A", "wrapper", "over", "Model", ".", "post", "()", "that", "handles", "the", "case", "where", "a", "Library", "has", "a", "PairedBarcode", "and", "the", "user", "may", "have", "supplied", "the", "PairedBarcode", "in", "the", "form", "of", "index1", "-", ...
359b040c0f2383b88c0b5548715fefd35f5f634c
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L969-L1005
train
nathankw/pulsarpy
pulsarpy/models.py
SequencingRequest.get_library_barcode_sequence_hash
def get_library_barcode_sequence_hash(self, inverse=False): """ Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inver...
python
def get_library_barcode_sequence_hash(self, inverse=False): """ Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inver...
[ "def", "get_library_barcode_sequence_hash", "(", "self", ",", "inverse", "=", "False", ")", ":", "action", "=", "os", ".", "path", ".", "join", "(", "self", ".", "record_url", ",", "\"get_library_barcode_sequence_hash\"", ")", "res", "=", "requests", ".", "get...
Calls the SequencingRequest's get_library_barcode_sequence_hash server-side endpoint to create a hash of the form {LibraryID -> barcode_sequence} for all Libraries on the SequencingRequest. Args: inverse: `bool`. True means to inverse the key and value pairs such that the barcode ...
[ "Calls", "the", "SequencingRequest", "s", "get_library_barcode_sequence_hash", "server", "-", "side", "endpoint", "to", "create", "a", "hash", "of", "the", "form", "{", "LibraryID", "-", ">", "barcode_sequence", "}", "for", "all", "Libraries", "on", "the", "Sequ...
359b040c0f2383b88c0b5548715fefd35f5f634c
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1047-L1074
train
nathankw/pulsarpy
pulsarpy/models.py
SequencingRun.library_sequencing_results
def library_sequencing_results(self): """ Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict. """ sres_ids = self.seque...
python
def library_sequencing_results(self): """ Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict. """ sres_ids = self.seque...
[ "def", "library_sequencing_results", "(", "self", ")", ":", "sres_ids", "=", "self", ".", "sequencing_result_ids", "res", "=", "{", "}", "for", "i", "in", "sres_ids", ":", "sres", "=", "SequencingResult", "(", "i", ")", "res", "[", "sres", ".", "library_id...
Generates a dict. where each key is a Library ID on the SequencingRequest and each value is the associated SequencingResult. Libraries that aren't yet with a SequencingResult are not inlcuded in the dict.
[ "Generates", "a", "dict", ".", "where", "each", "key", "is", "a", "Library", "ID", "on", "the", "SequencingRequest", "and", "each", "value", "is", "the", "associated", "SequencingResult", ".", "Libraries", "that", "aren", "t", "yet", "with", "a", "Sequencing...
359b040c0f2383b88c0b5548715fefd35f5f634c
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1098-L1109
train
nathankw/pulsarpy
pulsarpy/models.py
User.unarchive_user
def unarchive_user(self, user_id): """Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None. """ url = self.record_url + "/unarchive" res = requests.patch(url=url, json={"...
python
def unarchive_user(self, user_id): """Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None. """ url = self.record_url + "/unarchive" res = requests.patch(url=url, json={"...
[ "def", "unarchive_user", "(", "self", ",", "user_id", ")", ":", "url", "=", "self", ".", "record_url", "+", "\"/unarchive\"", "res", "=", "requests", ".", "patch", "(", "url", "=", "url", ",", "json", "=", "{", "\"user_id\"", ":", "user_id", "}", ",", ...
Unarchives the user with the specified user ID. Args: user_id: `int`. The ID of the user to unarchive. Returns: `NoneType`: None.
[ "Unarchives", "the", "user", "with", "the", "specified", "user", "ID", "." ]
359b040c0f2383b88c0b5548715fefd35f5f634c
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1179-L1191
train
nathankw/pulsarpy
pulsarpy/models.py
User.remove_api_key
def remove_api_key(self): """ Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None. """ url = self.record_url + "/remove_api_key" res = requests.patch(url=u...
python
def remove_api_key(self): """ Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None. """ url = self.record_url + "/remove_api_key" res = requests.patch(url=u...
[ "def", "remove_api_key", "(", "self", ")", ":", "url", "=", "self", ".", "record_url", "+", "\"/remove_api_key\"", "res", "=", "requests", ".", "patch", "(", "url", "=", "url", ",", "headers", "=", "HEADERS", ",", "verify", "=", "False", ")", "res", "....
Removes the user's existing API key, if present, and sets the current instance's 'api_key' attribute to the empty string. Returns: `NoneType`: None.
[ "Removes", "the", "user", "s", "existing", "API", "key", "if", "present", "and", "sets", "the", "current", "instance", "s", "api_key", "attribute", "to", "the", "empty", "string", "." ]
359b040c0f2383b88c0b5548715fefd35f5f634c
https://github.com/nathankw/pulsarpy/blob/359b040c0f2383b88c0b5548715fefd35f5f634c/pulsarpy/models.py#L1206-L1217
train
Vital-Fernandez/dazer
bin/lib/ssp_functions/ssp_synthesis_tools.py
ssp_fitter.generate_synthObs
def generate_synthObs(self, bases_wave, bases_flux, basesCoeff, Av_star, z_star, sigma_star, resample_range = None, resample_int = 1): '''basesWave: Bases wavelength must be at rest''' nbases = basesCoeff.shape[0] bases_wave_resam = arange(int(resample_range[0]),...
python
def generate_synthObs(self, bases_wave, bases_flux, basesCoeff, Av_star, z_star, sigma_star, resample_range = None, resample_int = 1): '''basesWave: Bases wavelength must be at rest''' nbases = basesCoeff.shape[0] bases_wave_resam = arange(int(resample_range[0]),...
[ "def", "generate_synthObs", "(", "self", ",", "bases_wave", ",", "bases_flux", ",", "basesCoeff", ",", "Av_star", ",", "z_star", ",", "sigma_star", ",", "resample_range", "=", "None", ",", "resample_int", "=", "1", ")", ":", "nbases", "=", "basesCoeff", ".",...
basesWave: Bases wavelength must be at rest
[ "basesWave", ":", "Bases", "wavelength", "must", "be", "at", "rest" ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/ssp_functions/ssp_synthesis_tools.py#L683-L728
train
paydunya/paydunya-python
paydunya/__init__.py
Payment._process
def _process(self, resource=None, data={}): """Processes the current transaction Sends an HTTP request to the PAYDUNYA API server """ # use object's data if no data is passed _data = data or self._data rsc_url = self.get_rsc_endpoint(resource) if _data: ...
python
def _process(self, resource=None, data={}): """Processes the current transaction Sends an HTTP request to the PAYDUNYA API server """ # use object's data if no data is passed _data = data or self._data rsc_url = self.get_rsc_endpoint(resource) if _data: ...
[ "def", "_process", "(", "self", ",", "resource", "=", "None", ",", "data", "=", "{", "}", ")", ":", "# use object's data if no data is passed", "_data", "=", "data", "or", "self", ".", "_data", "rsc_url", "=", "self", ".", "get_rsc_endpoint", "(", "resource"...
Processes the current transaction Sends an HTTP request to the PAYDUNYA API server
[ "Processes", "the", "current", "transaction" ]
bb55791e2814788aec74162d9d78970815f37c30
https://github.com/paydunya/paydunya-python/blob/bb55791e2814788aec74162d9d78970815f37c30/paydunya/__init__.py#L86-L107
train
paydunya/paydunya-python
paydunya/__init__.py
Payment.add_header
def add_header(self, header): """Add a custom HTTP header to the client's request headers""" if type(header) is dict: self._headers.update(header) else: raise ValueError( "Dictionary expected, got '%s' instead" % type(header) )
python
def add_header(self, header): """Add a custom HTTP header to the client's request headers""" if type(header) is dict: self._headers.update(header) else: raise ValueError( "Dictionary expected, got '%s' instead" % type(header) )
[ "def", "add_header", "(", "self", ",", "header", ")", ":", "if", "type", "(", "header", ")", "is", "dict", ":", "self", ".", "_headers", ".", "update", "(", "header", ")", "else", ":", "raise", "ValueError", "(", "\"Dictionary expected, got '%s' instead\"", ...
Add a custom HTTP header to the client's request headers
[ "Add", "a", "custom", "HTTP", "header", "to", "the", "client", "s", "request", "headers" ]
bb55791e2814788aec74162d9d78970815f37c30
https://github.com/paydunya/paydunya-python/blob/bb55791e2814788aec74162d9d78970815f37c30/paydunya/__init__.py#L114-L121
train
novopl/peltak
src/peltak/extra/changelog/commands.py
changelog_cli
def changelog_cli(ctx): # type: () -> None """ Generate changelog from commit messages. """ if ctx.invoked_subcommand: return from peltak.core import shell from . import logic shell.cprint(logic.changelog())
python
def changelog_cli(ctx): # type: () -> None """ Generate changelog from commit messages. """ if ctx.invoked_subcommand: return from peltak.core import shell from . import logic shell.cprint(logic.changelog())
[ "def", "changelog_cli", "(", "ctx", ")", ":", "# type: () -> None", "if", "ctx", ".", "invoked_subcommand", ":", "return", "from", "peltak", ".", "core", "import", "shell", "from", ".", "import", "logic", "shell", ".", "cprint", "(", "logic", ".", "changelog...
Generate changelog from commit messages.
[ "Generate", "changelog", "from", "commit", "messages", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/changelog/commands.py#L24-L32
train
Varkal/chuda
chuda/arguments.py
Argument.convert_to_argument
def convert_to_argument(self): ''' Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser ''' field_list = [ "action", "nargs", "const", "default", "type", "choices", "required", "help", "metavar", "des...
python
def convert_to_argument(self): ''' Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser ''' field_list = [ "action", "nargs", "const", "default", "type", "choices", "required", "help", "metavar", "des...
[ "def", "convert_to_argument", "(", "self", ")", ":", "field_list", "=", "[", "\"action\"", ",", "\"nargs\"", ",", "\"const\"", ",", "\"default\"", ",", "\"type\"", ",", "\"choices\"", ",", "\"required\"", ",", "\"help\"", ",", "\"metavar\"", ",", "\"dest\"", "...
Convert the Argument object to a tuple use in :meth:`~argparse.ArgumentParser.add_argument` calls on the parser
[ "Convert", "the", "Argument", "object", "to", "a", "tuple", "use", "in", ":", "meth", ":", "~argparse", ".", "ArgumentParser", ".", "add_argument", "calls", "on", "the", "parser" ]
0d93b716dede35231c21be97bcc19a656655983f
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/arguments.py#L52-L67
train
Varkal/chuda
chuda/arguments.py
Option.get_default_name
def get_default_name(self): ''' Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option ''' long_names = [name for name ...
python
def get_default_name(self): ''' Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option ''' long_names = [name for name ...
[ "def", "get_default_name", "(", "self", ")", ":", "long_names", "=", "[", "name", "for", "name", "in", "self", ".", "name", "if", "name", ".", "startswith", "(", "\"--\"", ")", "]", "short_names", "=", "[", "name", "for", "name", "in", "self", ".", "...
Return the default generated name to store value on the parser for this option. eg. An option *['-s', '--use-ssl']* will generate the *use_ssl* name Returns: str: the default name of the option
[ "Return", "the", "default", "generated", "name", "to", "store", "value", "on", "the", "parser", "for", "this", "option", "." ]
0d93b716dede35231c21be97bcc19a656655983f
https://github.com/Varkal/chuda/blob/0d93b716dede35231c21be97bcc19a656655983f/chuda/arguments.py#L84-L99
train
gpiantoni/bidso
bidso/files.py
file_Core.get_filename
def get_filename(self, base_dir=None, modality=None): """Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filen...
python
def get_filename(self, base_dir=None, modality=None): """Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filen...
[ "def", "get_filename", "(", "self", ",", "base_dir", "=", "None", ",", "modality", "=", "None", ")", ":", "filename", "=", "'sub-'", "+", "self", ".", "subject", "if", "self", ".", "session", "is", "not", "None", ":", "filename", "+=", "'_ses-'", "+", ...
Construct filename based on the attributes. Parameters ---------- base_dir : Path path of the root directory. If specified, the return value is a Path, with base_dir / sub-XXX / (ses-XXX /) modality / filename otherwise the return value is a string. m...
[ "Construct", "filename", "based", "on", "the", "attributes", "." ]
af163b921ec4e3d70802de07f174de184491cfce
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/files.py#L37-L87
train
gpiantoni/bidso
bidso/files.py
file_Tsv.get
def get(self, filter_lambda=None, map_lambda=None): """Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function ...
python
def get(self, filter_lambda=None, map_lambda=None): """Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function ...
[ "def", "get", "(", "self", ",", "filter_lambda", "=", "None", ",", "map_lambda", "=", "None", ")", ":", "if", "filter_lambda", "is", "None", ":", "filter_lambda", "=", "lambda", "x", ":", "True", "if", "map_lambda", "is", "None", ":", "map_lambda", "=", ...
Select elements of the TSV, using python filter and map. Parameters ---------- filter_lambda : function function to filter the tsv rows (the function needs to return True/False) map_lambda : function function to select the tsv columns Returns ---...
[ "Select", "elements", "of", "the", "TSV", "using", "python", "filter", "and", "map", "." ]
af163b921ec4e3d70802de07f174de184491cfce
https://github.com/gpiantoni/bidso/blob/af163b921ec4e3d70802de07f174de184491cfce/bidso/files.py#L95-L125
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.connect
def connect(self, client_id: str = None, client_secret: str = None) -> dict: """Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id...
python
def connect(self, client_id: str = None, client_secret: str = None) -> dict: """Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id...
[ "def", "connect", "(", "self", ",", "client_id", ":", "str", "=", "None", ",", "client_secret", ":", "str", "=", "None", ")", "->", "dict", ":", "# instanciated or direct call", "if", "not", "client_id", "and", "not", "client_secret", ":", "client_id", "=", ...
Authenticate application and get token bearer. Isogeo API uses oAuth 2.0 protocol (https://tools.ietf.org/html/rfc6749) see: http://help.isogeo.com/api/fr/authentication/groupsapps.html :param str client_id: application oAuth2 identifier :param str client_secret: application oAuth2 sec...
[ "Authenticate", "application", "and", "get", "token", "bearer", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L177-L234
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo._check_bearer_validity
def _check_bearer_validity(decorated_func): """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. Se...
python
def _check_bearer_validity(decorated_func): """Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. Se...
[ "def", "_check_bearer_validity", "(", "decorated_func", ")", ":", "@", "wraps", "(", "decorated_func", ")", "def", "wrapper", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# compare token expiration date and ask for a new one if it's expired", "...
Check API Bearer token validity. Isogeo ID delivers authentication bearers which are valid during a certain time. So this decorator checks the validity of the token comparing with actual datetime (UTC) and renews it if necessary. See: http://tools.ietf.org/html/rfc6750#section-2 ...
[ "Check", "API", "Bearer", "token", "validity", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L246-L270
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.search
def search( self, token: dict = None, query: str = "", bbox: list = None, poly: str = None, georel: str = None, order_by: str = "_created", order_dir: str = "desc", page_size: int = 100, offset: int = 0, share: str = None, s...
python
def search( self, token: dict = None, query: str = "", bbox: list = None, poly: str = None, georel: str = None, order_by: str = "_created", order_dir: str = "desc", page_size: int = 100, offset: int = 0, share: str = None, s...
[ "def", "search", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "query", ":", "str", "=", "\"\"", ",", "bbox", ":", "list", "=", "None", ",", "poly", ":", "str", "=", "None", ",", "georel", ":", "str", "=", "None", ",", "order_by", "...
Search within the resources shared to the application. It's the main method to use. :param str token: API auth token - DEPRECATED: token is now automatically included :param str query: search terms and semantic filters. Equivalent of **q** parameter in Isogeo API. It could be a simple...
[ "Search", "within", "the", "resources", "shared", "to", "the", "application", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L274-L450
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.resource
def resource( self, token: dict = None, id_resource: str = None, subresource=None, include: list = [], prot: str = "https", ) -> dict: """Get complete or partial metadata about one specific resource. :param str token: API auth token :param str...
python
def resource( self, token: dict = None, id_resource: str = None, subresource=None, include: list = [], prot: str = "https", ) -> dict: """Get complete or partial metadata about one specific resource. :param str token: API auth token :param str...
[ "def", "resource", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "id_resource", ":", "str", "=", "None", ",", "subresource", "=", "None", ",", "include", ":", "list", "=", "[", "]", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", ...
Get complete or partial metadata about one specific resource. :param str token: API auth token :param str id_resource: metadata UUID to get :param list include: subresources that should be included. Must be a list of strings. Available values: 'isogeo.SUBRESOURCES' :param str p...
[ "Get", "complete", "or", "partial", "metadata", "about", "one", "specific", "resource", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L453-L494
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.shares
def shares(self, token: dict = None, prot: str = "https") -> dict: """Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth paramete...
python
def shares(self, token: dict = None, prot: str = "https") -> dict: """Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth paramete...
[ "def", "shares", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# passing auth parameter", "shares_url", "=", "\"{}://v1.{}.isogeo.com/shares/\"", ".", "format", "(", "prot", ",", "sel...
Get information about shares which feed the application. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
[ "Get", "information", "about", "shares", "which", "feed", "the", "application", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L498-L515
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.share
def share( self, share_id: str, token: dict = None, augment: bool = False, prot: str = "https", ) -> dict: """Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param ...
python
def share( self, share_id: str, token: dict = None, augment: bool = False, prot: str = "https", ) -> dict: """Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param ...
[ "def", "share", "(", "self", ",", "share_id", ":", "str", ",", "token", ":", "dict", "=", "None", ",", "augment", ":", "bool", "=", "False", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", "->", "dict", ":", "# passing auth parameter", "share_url"...
Get information about a specific share and its applications. :param str token: API auth token :param str share_id: share UUID :param bool augment: option to improve API response by adding some tags on the fly. :param str prot: https [DEFAULT] or http (use it only for d...
[ "Get", "information", "about", "a", "specific", "share", "and", "its", "applications", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L518-L555
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.licenses
def licenses( self, token: dict = None, owner_id: str = None, prot: str = "https" ) -> dict: """Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http ...
python
def licenses( self, token: dict = None, owner_id: str = None, prot: str = "https" ) -> dict: """Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http ...
[ "def", "licenses", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "owner_id", ":", "str", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# handling request parameters", "payload", "=", "{", "\"gid\"", ":", "...
Get information about licenses owned by a specific workgroup. :param str token: API auth token :param str owner_id: workgroup UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
[ "Get", "information", "about", "licenses", "owned", "by", "a", "specific", "workgroup", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L559-L590
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.license
def license(self, license_id: str, token: dict = None, prot: str = "https") -> dict: """Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). ...
python
def license(self, license_id: str, token: dict = None, prot: str = "https") -> dict: """Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). ...
[ "def", "license", "(", "self", ",", "license_id", ":", "str", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# handling request parameters", "payload", "=", "{", "\"lid\"", ":", "license_id", "...
Get details about a specific license. :param str token: API auth token :param str license_id: license UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
[ "Get", "details", "about", "a", "specific", "license", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L593-L620
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.thesauri
def thesauri(self, token: dict = None, prot: str = "https") -> dict: """Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth parameter thez_url = "{...
python
def thesauri(self, token: dict = None, prot: str = "https") -> dict: """Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs). """ # passing auth parameter thez_url = "{...
[ "def", "thesauri", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "prot", ":", "str", "=", "\"https\"", ")", "->", "dict", ":", "# passing auth parameter", "thez_url", "=", "\"{}://v1.{}.isogeo.com/thesauri\"", ".", "format", "(", "prot", ",", "se...
Get list of available thesauri. :param str token: API auth token :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
[ "Get", "list", "of", "available", "thesauri", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L625-L642
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.thesaurus
def thesaurus( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", prot: str = "https", ) -> dict: """Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or htt...
python
def thesaurus( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", prot: str = "https", ) -> dict: """Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or htt...
[ "def", "thesaurus", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "thez_id", ":", "str", "=", "\"1616597fbc4348c8b11ef9d59cf594c8\"", ",", "prot", ":", "str", "=", "\"https\"", ",", ")", "->", "dict", ":", "# handling request parameters", "payload"...
Get a thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str prot: https [DEFAULT] or http (use it only for dev and tracking needs).
[ "Get", "a", "thesaurus", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L645-L677
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.keywords
def keywords( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", query: str = "", offset: int = 0, order_by: str = "text", order_dir: str = "desc", page_size: int = 20, specific_md: list = [], specific_tag: list = ...
python
def keywords( self, token: dict = None, thez_id: str = "1616597fbc4348c8b11ef9d59cf594c8", query: str = "", offset: int = 0, order_by: str = "text", order_dir: str = "desc", page_size: int = 20, specific_md: list = [], specific_tag: list = ...
[ "def", "keywords", "(", "self", ",", "token", ":", "dict", "=", "None", ",", "thez_id", ":", "str", "=", "\"1616597fbc4348c8b11ef9d59cf594c8\"", ",", "query", ":", "str", "=", "\"\"", ",", "offset", ":", "int", "=", "0", ",", "order_by", ":", "str", "=...
Search for keywords within a specific thesaurus. :param str token: API auth token :param str thez_id: thesaurus UUID :param str query: search terms :param int offset: pagination start :param str order_by: sort criteria. Available values : - count.group, ...
[ "Search", "for", "keywords", "within", "a", "specific", "thesaurus", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L680-L746
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.dl_hosted
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 ...
python
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\"",...
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 ...
[ "Download", "hosted", "resource", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L750-L843
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.xml19139
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...
python
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\"", ",", ")", ":", "# check metadata UUID", "if", "not", "checker...
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).
[ "Get", "resource", "exported", "into", "XML", "ISO", "19139", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L846-L884
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.add_tags_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 ...
python
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", "(", ")", ")", ":", "# check if shares_id have already been retrieved or not", "if", "not", "hasattr", "(", "self", ",", "\"shares_id\"", ")", ":", "shares", "=", "self", ".", "share...
Add shares list to the tags attributes in search results. :param dict tags: tags dictionary from a search request
[ "Add", "shares", "list", "to", "the", "tags", "attributes", "in", "search", "results", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L887-L901
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.get_app_properties
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...
python
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\"", ")", ":", "# check if app properties have already been retrieved or not", "if", "not", "hasattr", "(", "self", ",", "\"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).
[ "Get", "information", "about", "the", "application", "declared", "on", "Isogeo", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L904-L927
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.get_directives
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...
python
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", ":", "# search request", "req_url", "=", "\"{}://v1.{}.isogeo.com/directives\"", ".", "format", "(", "prot", ",", "sel...
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).
[ "Get", "environment", "directives", "which", "represent", "INSPIRE", "limitations", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L951-L969
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.get_coordinate_systems
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...
python
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", ":", "# if specific format", "if", "isinstance", "(", "srs_code", ...
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).
[ "Get", "available", "coordinate", "systems", "in", "Isogeo", "API", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L972-L1001
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/isogeo_sdk.py
Isogeo.get_formats
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...
python
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", ":", "# if specific format", "if", "isinstance", "(", "format_code", ","...
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).
[ "Get", "formats", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/isogeo_sdk.py#L1004-L1033
train
kajala/django-jutil
jutil/parse.py
parse_bool
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...
python
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", ":", "if", "isinstance", "(", "v", ",", "bool", ")", ":", "return", "v", "s", "=", "str", "(", "v", ")", ".", "lower", "...
Parses boolean value :param v: Input string :param default: Default value if exceptions=False :param exceptions: Raise exception on error or not :return: bool
[ "Parses", "boolean", "value", ":", "param", "v", ":", "Input", "string", ":", "param", "default", ":", "Default", "value", "if", "exceptions", "=", "False", ":", "param", "exceptions", ":", "Raise", "exception", "on", "error", "or", "not", ":", "return", ...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/parse.py#L22-L40
train
kajala/django-jutil
jutil/parse.py
parse_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 ...
python
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", ":", "try", ":", "t", "=", "dateutil_parse", "(", "v", ",", "default", "=", "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...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/parse.py#L43-L60
train
InformaticsMatters/pipelines-utils
src/python/pipelines_utils/TypedColumnReader.py
convert_boolean
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...
python
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", ")", ":", "lean_string_value", "=", "string_value", ".", "strip", "(", ")", ".", "lower", "(", ")", "if", "lean_string_value", "in", "[", "'yes'", ",", "'true'", ",", "'on'", ",", "'1'", "]", ":", "return", ...
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....
[ "Converts", "a", "string", "to", "a", "boolean", "(", "see", "CONVERTERS", ")", ".", "There", "is", "a", "converter", "function", "for", "each", "column", "type", "." ]
058aa6eceeff28c4ae402f6f58c58720bff0298e
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/TypedColumnReader.py#L68-L88
train
InformaticsMatters/pipelines-utils
src/python/pipelines_utils/TypedColumnReader.py
TypedColumnReader._handle_hdr
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...
python
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", ")", ":", "column_number", "=", "1", "for", "cell", "in", "hdr", ":", "cell_parts", "=", "cell", ".", "split", "(", "self", ".", "_type_sep", ")", "if", "len", "(", "cell_parts", ")", "not", "in", "[", ...
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...
[ "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", ...
058aa6eceeff28c4ae402f6f58c58720bff0298e
https://github.com/InformaticsMatters/pipelines-utils/blob/058aa6eceeff28c4ae402f6f58c58720bff0298e/src/python/pipelines_utils/TypedColumnReader.py#L259-L293
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/samples/udata_client_datagouvfr.py
DataGouvFr.search_datasets
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.""" ...
python
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", ",", "reu...
Search datasets within uData portal.
[ "Search", "datasets", "within", "uData", "portal", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/udata_client_datagouvfr.py#L79-L112
train
isogeo/isogeo-api-py-minsdk
isogeo_pysdk/samples/udata_client_datagouvfr.py
DataGouvFr.get_filters_values
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...
python
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", ")", ":", "# DATASETS --", "# badges", "self", ".", "_DST_BADGES", "=", "requests", ".", "get", "(", "self", ".", "base_url", "+", "\"datasets/badges/\"", ")", ".", "json", "(", ")", "# licences", "self", ".", "_DST_...
Get different filters values as dicts.
[ "Get", "different", "filters", "values", "as", "dicts", "." ]
57a604be92c7767b26abd247012cc1a584b386a0
https://github.com/isogeo/isogeo-api-py-minsdk/blob/57a604be92c7767b26abd247012cc1a584b386a0/isogeo_pysdk/samples/udata_client_datagouvfr.py#L115-L167
train
novopl/peltak
src/peltak_appengine/logic.py
deploy
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...
python
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", "gae_app", "=", "GaeApp", ".", "for_branch", "(", "git", ".", "current_branch", "(", ")", ".", "name", ")", "if", "gae_app", "is...
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...
[ "Deploy", "the", "app", "to", "AppEngine", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L41-L73
train
novopl/peltak
src/peltak_appengine/logic.py
devserver
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...
python
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", "admin_port", "=", "admin_port", "or", "(", "port", "+", "1", ")", "args", "=", "[", "'--port={}'", ".", "format", "(", "port", ")", ",", "'--ad...
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.
[ "Run", "devserver", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L77-L100
train
novopl/peltak
src/peltak_appengine/logic.py
setup_ci
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...
python
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", "gcloud_path", "=", "shell", ".", "run", "(", "'which gcloud'", ",", "capture", "=", "True", ")", ".", "stdout", ".", "strip", "(", ")", "sdk_path", "=", "normpath", "(", "join", "(", "gcloud_path", ...
Setup AppEngine SDK on CircleCI
[ "Setup", "AppEngine", "SDK", "on", "CircleCI" ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak_appengine/logic.py#L104-L124
train
novopl/peltak
src/peltak/core/util.py
mark_experimental
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...
python
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", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "# pylint: disable=missing-docstring", "from", "peltak", ".", "core", "i...
Mark function as experimental. Args: fn (FunctionType): The command function to decorate.
[ "Mark", "function", "as", "experimental", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L74-L93
train
novopl/peltak
src/peltak/core/util.py
mark_deprecated
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) ...
python
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", "def", "decorator", "(", "fn", ")", ":", "# pylint: disable=missing-docstring", "@", "wraps", "(", "fn", ")", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")"...
Mark command as deprecated. Args: replaced_by (str): The command that deprecated this command and should be used instead.
[ "Mark", "command", "as", "deprecated", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L96-L117
train
novopl/peltak
src/peltak/core/util.py
in_batches
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 ...
python
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]]", "items", "=", "list", "(", "iterable", ")", "size", "=", "len", "(", "items", ")", "for", "i", "in", "range", "(", "0", ",", "size", ",", ...
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...
[ "Split", "the", "given", "iterable", "into", "batches", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L186-L217
train
novopl/peltak
src/peltak/core/util.py
yaml_dump
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 ...
python
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", "return", "yaml", ".", "dump", "(", "data", ",", "stream", "=", "stream", ",", "Dumper", "=", "Dumper", ",", "default_flow_style", "=", "Fals...
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.
[ "Dump", "data", "to", "a", "YAML", "string", "/", "file", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L233-L252
train
novopl/peltak
src/peltak/core/util.py
cached_result.clear
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...
python
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", "if", "hasattr", "(", "fn", ",", "cls", ".", "CACHE_VAR", ")", ":", "delattr", "(", "fn", ",", "cls", ".", "CACHE_VAR", ")" ]
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.
[ "Clear", "result", "cache", "on", "the", "given", "function", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/core/util.py#L172-L183
train
novopl/peltak
src/peltak/extra/gitflow/logic/task.py
start
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 ...
python
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", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "task_branch", "=", "'task/'", "+", "common", ".", "to_branch_name", "(", "name", ")", "if", "branch", ".", "type...
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.
[ "Start", "working", "on", "a", "new", "feature", "by", "branching", "off", "develop", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L33-L51
train
novopl/peltak
src/peltak/extra/gitflow/logic/task.py
update
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...
python
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", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "base_branch", "=", "common", ".", "get_base_branch", "(", ")", "common", ".", "assert_branch_type", "(", "'task'", ")", "com...
Update the feature with updates committed to develop. This will merge current develop into the current branch.
[ "Update", "the", "feature", "with", "updates", "committed", "to", "develop", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L54-L67
train
novopl/peltak
src/peltak/extra/gitflow/logic/task.py
finish
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...
python
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", "pretend", "=", "context", ".", "get", "(", "'pretend'", ",", "False", ")", "if", "not", "pretend", "and", "(", "git", ".", "staged", "(", ")", "or", "git", ".", "unstaged", "(", ")", ")", ":", ...
Merge current feature branch into develop.
[ "Merge", "current", "feature", "branch", "into", "develop", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L83-L114
train
novopl/peltak
src/peltak/extra/gitflow/logic/task.py
merged
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...
python
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", "base_branch", "=", "common", ".", "get_base_branch", "(", ")", "branch", "=", "git", ".", "current_branch", "(", "refresh", "=", "True", ")", "common", ".", "assert_branch_type", "(", "'task'", ")", "# P...
Cleanup a remotely merged branch.
[ "Cleanup", "a", "remotely", "merged", "branch", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/task.py#L117-L133
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
mutagen_call
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 ...
python
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", ")", ":", "try", ":", "return", "func", "(", "*", "args", ",", "*", "*", "kwargs", ")", "except", "mutagen", ".", "MutagenError", "as", "exc"...
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...
[ "Call", "a", "Mutagen", "function", "with", "appropriate", "error", "handling", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L117-L139
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
_safe_cast
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...
python
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", ")", ":", "if", "val", "is", "None", ":", "return", "None", "if", "out_type", "==", "int", ":", "if", "isinstance", "(", "val", ",", "int", ")", "or", "isinstance", "(", "val", ",", "float", ")", ":...
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.
[ "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", ...
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L144-L199
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
_unpack_asf_image
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...
python
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", ")", ":", "type", ",", "size", "=", "struct", ".", "unpack_from", "(", "'<bi'", ",", "data", ")", "pos", "=", "5", "mime", "=", "b''", "while", "data", "[", "pos", ":", "pos", "+", "2", "]", "!=", "b'\\x00\\...
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...
[ "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", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L204-L227
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
_pack_asf_image
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
python
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", "=", "\"\"", ")", ":", "tag_data", "=", "struct", ".", "pack", "(", "'<bi'", ",", "type", ",", "len", "(", "data", ")", ")", "tag_data", "+=", "mime", "....
Pack image data for a WM/Picture tag.
[ "Pack", "image", "data", "for", "a", "WM", "/", "Picture", "tag", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L230-L237
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
_sc_decode
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...
python
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", ")", ":", "# 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...
Convert a Sound Check bytestring value to a (gain, peak) tuple as used by ReplayGain.
[ "Convert", "a", "Sound", "Check", "bytestring", "value", "to", "a", "(", "gain", "peak", ")", "tuple", "as", "used", "by", "ReplayGain", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L242-L280
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
_sc_encode
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 ...
python
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", ")", ":", "# 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 ...
Encode ReplayGain gain/peak values as a Sound Check string.
[ "Encode", "ReplayGain", "gain", "/", "peak", "values", "as", "a", "Sound", "Check", "string", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L283-L304
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
image_mime_type
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...
python
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", ")", ":", "# 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...
Return the MIME type of the image data (a bytestring).
[ "Return", "the", "MIME", "type", "of", "the", "image", "data", "(", "a", "bytestring", ")", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L329-L348
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
StorageStyle.deserialize
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...
python
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", ")", ":", "if", "self", ".", "suffix", "and", "isinstance", "(", "mutagen_value", ",", "six", ".", "text_type", ")", "and", "mutagen_value", ".", "endswith", "(", "self", ".", "suffix", ")", ":", "...
Given a raw value stored on a Mutagen object, decode and return the represented value.
[ "Given", "a", "raw", "value", "stored", "on", "a", "Mutagen", "object", "decode", "and", "return", "the", "represented", "value", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L494-L502
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
StorageStyle.set
def set(self, mutagen_file, value): """Assign the value for the field using this style. """ self.store(mutagen_file, self.serialize(value))
python
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", ")", ":", "self", ".", "store", "(", "mutagen_file", ",", "self", ".", "serialize", "(", "value", ")", ")" ]
Assign the value for the field using this style.
[ "Assign", "the", "value", "for", "the", "field", "using", "this", "style", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L506-L509
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
StorageStyle.serialize
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....
python
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", ")", ":", "if", "isinstance", "(", "value", ",", "float", ")", "and", "self", ".", "as_type", "is", "six", ".", "text_type", ":", "value", "=", "u'{0:.{1}f}'", ".", "format", "(", "value", ",", "self", "...
Convert the external Python value to a type that is suitable for storing in a Mutagen file object.
[ "Convert", "the", "external", "Python", "value", "to", "a", "type", "that", "is", "suitable", "for", "storing", "in", "a", "Mutagen", "file", "object", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L516-L537
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
ListStorageStyle.get_list
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)]
python
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", ")", ":", "return", "[", "self", ".", "deserialize", "(", "item", ")", "for", "item", "in", "self", ".", "fetch", "(", "mutagen_file", ")", "]" ]
Get a list of all values for the field using this style.
[ "Get", "a", "list", "of", "all", "values", "for", "the", "field", "using", "this", "style", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L569-L572
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
ListStorageStyle.set_list
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])
python
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", ")", ":", "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.
[ "Set", "all", "values", "for", "the", "field", "using", "this", "style", ".", "values", "should", "be", "an", "iterable", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L588-L592
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MP3ImageStorageStyle.deserialize
def deserialize(self, apic_frame): """Convert APIC frame into Image.""" return Image(data=apic_frame.data, desc=apic_frame.desc, type=apic_frame.type)
python
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", ")", ":", "return", "Image", "(", "data", "=", "apic_frame", ".", "data", ",", "desc", "=", "apic_frame", ".", "desc", ",", "type", "=", "apic_frame", ".", "type", ")" ]
Convert APIC frame into Image.
[ "Convert", "APIC", "frame", "into", "Image", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L933-L936
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MP3ImageStorageStyle.serialize
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...
python
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", ")", ":", "assert", "isinstance", "(", "image", ",", "Image", ")", "frame", "=", "mutagen", ".", "id3", ".", "Frames", "[", "self", ".", "key", "]", "(", ")", "frame", ".", "data", "=", "image", ".", ...
Return an APIC frame populated with data from ``image``.
[ "Return", "an", "APIC", "frame", "populated", "with", "data", "from", "image", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L947-L966
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
VorbisImageStorageStyle.serialize
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...
python
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", ")", ":", "pic", "=", "mutagen", ".", "flac", ".", "Picture", "(", ")", "pic", ".", "data", "=", "image", ".", "data", "pic", ".", "type", "=", "image", ".", "type_index", "pic", ".", "mime", "=", "i...
Turn a Image into a base64 encoded FLAC picture block.
[ "Turn", "a", "Image", "into", "a", "base64", "encoded", "FLAC", "picture", "block", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1036-L1048
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
FlacImageStorageStyle.store
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)
python
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", ")", ":", "mutagen_file", ".", "clear_pictures", "(", ")", "for", "pic", "in", "pictures", ":", "mutagen_file", ".", "add_picture", "(", "pic", ")" ]
``pictures`` is a list of mutagen.flac.Picture instances.
[ "pictures", "is", "a", "list", "of", "mutagen", ".", "flac", ".", "Picture", "instances", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1066-L1071
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
FlacImageStorageStyle.serialize
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
python
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", ")", ":", "pic", "=", "mutagen", ".", "flac", ".", "Picture", "(", ")", "pic", ".", "data", "=", "image", ".", "data", "pic", ".", "type", "=", "image", ".", "type_index", "pic", ".", "mime", "=", "i...
Turn a Image into a mutagen.flac.Picture.
[ "Turn", "a", "Image", "into", "a", "mutagen", ".", "flac", ".", "Picture", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1073-L1081
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
APEv2ImageStorageStyle.delete
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
python
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", ")", ":", "for", "cover_tag", "in", "self", ".", "TAG_NAMES", ".", "values", "(", ")", ":", "try", ":", "del", "mutagen_file", "[", "cover_tag", "]", "except", "KeyError", ":", "pass" ]
Remove all images from the file.
[ "Remove", "all", "images", "from", "the", "file", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1150-L1157
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaField.styles
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
python
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", ")", ":", "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.
[ "Yields", "the", "list", "of", "storage", "styles", "of", "this", "field", "that", "can", "handle", "the", "MediaFile", "s", "format", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1183-L1189
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaField._none_value
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: ...
python
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", ")", ":", "if", "self", ".", "out_type", "==", "int", ":", "return", "0", "elif", "self", ".", "out_type", "==", "float", ":", "return", "0.0", "elif", "self", ".", "out_type", "==", "bool", ":", "return", "False", ...
Get an appropriate "null" value for this field's type. This is used internally when setting the field to None.
[ "Get", "an", "appropriate", "null", "value", "for", "this", "field", "s", "type", ".", "This", "is", "used", "internally", "when", "setting", "the", "field", "to", "None", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1209-L1220
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
DateField._get_date_tuple
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)....
python
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 the underlying data and split on hyphens and slashes.", "datestring", "=", "super", "(", "DateField", ",", "self", ")", ".", "__get__", "(", "mediafile", ",", "None", ")", "if", "isinstance", ...
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", "a", "3", "-", "item", "sequence", "representing", "the", "date", "consisting", "of", "a", "year", "month", "and", "day", "number", ".", "Each", "number", "is", "either", "an", "integer", "or", "None", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1293-L1323
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
DateField._set_date_tuple
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...
python
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", ")", ":", "if", "year", "is", "None", ":", "self", ".", "__delete__", "(", "mediafile", ")", "return", "date", "=", "[", "u'{0:0...
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.
[ "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", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1325-L1343
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.save
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...
python
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", ")", ":", "# 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...
Write the object's tags back to the file. May throw `UnreadableFileError`.
[ "Write", "the", "object", "s", "tags", "back", "to", "the", "file", ".", "May", "throw", "UnreadableFileError", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1492-L1506
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.fields
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(...
python
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", ")", ":", "for", "property", ",", "descriptor", "in", "cls", ".", "__dict__", ".", "items", "(", ")", ":", "if", "isinstance", "(", "descriptor", ",", "MediaField", ")", ":", "if", "isinstance", "(", "property", ",", "bytes...
Get the names of all writable properties that reflect metadata tags (i.e., those that are instances of :class:`MediaField`).
[ "Get", "the", "names", "of", "all", "writable", "properties", "that", "reflect", "metadata", "tags", "(", "i", ".", "e", ".", "those", "that", "are", "instances", "of", ":", "class", ":", "MediaField", ")", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1517-L1529
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile._field_sort_name
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...
python
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", ")", ":", "if", "isinstance", "(", "cls", ".", "__dict__", "[", "name", "]", ",", "DateItemField", ")", ":", "name", "=", "re", ".", "sub", "(", "'year'", ",", "'date0'", ",", "name", ")", "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...
[ "Get", "a", "sort", "key", "for", "a", "field", "name", "that", "determines", "the", "order", "fields", "should", "be", "written", "in", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1532-L1545
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.sorted_fields
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...
python
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", ")", ":", "for", "property", "in", "sorted", "(", "cls", ".", "fields", "(", ")", ",", "key", "=", "cls", ".", "_field_sort_name", ")", ":", "yield", "property" ]
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.
[ "Get", "the", "names", "of", "all", "writable", "metadata", "fields", "sorted", "in", "the", "order", "that", "they", "should", "be", "written", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1548-L1557
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.add_field
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...
python
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", ")", ":", "if", "not", "isinstance", "(", "descriptor", ",", "MediaField", ")", ":", "raise", "ValueError", "(", "u'{0} must be an instance of MediaField'", ".", "format", "(", "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`.
[ "Add", "a", "field", "to", "store", "custom", "tags", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1571-L1585
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.update
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 ...
python
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", ")", ":", "for", "field", "in", "self", ".", "sorted_fields", "(", ")", ":", "if", "field", "in", "dict", ":", "if", "dict", "[", "field", "]", "is", "None", ":", "delattr", "(", "self", ",", "field", ")...
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`.
[ "Set", "all", "field", "values", "from", "a", "dictionary", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L1587-L1600
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.samplerate
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
python
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", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'sample_rate'", ")", ":", "return", "self", ".", "mgfile", ".", "info", ".", "sample_rate", "elif", "self", ".", "type", "==", "'opus'", ":", ...
The audio's sample rate (an int).
[ "The", "audio", "s", "sample", "rate", "(", "an", "int", ")", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2162-L2169
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.bitdepth
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
python
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", ")", ":", "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).
[ "The", "number", "of", "bits", "per", "sample", "in", "the", "audio", "encoding", "(", "an", "int", ")", ".", "Only", "available", "for", "certain", "file", "formats", "(", "zero", "where", "unavailable", ")", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2172-L2179
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.channels
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
python
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", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'channels'", ")", ":", "return", "self", ".", "mgfile", ".", "info", ".", "channels", "return", "0" ]
The number of channels in the audio (an int).
[ "The", "number", "of", "channels", "in", "the", "audio", "(", "an", "int", ")", "." ]
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2182-L2186
train
Josef-Friedrich/phrydy
phrydy/mediafile.py
MediaFile.bitrate
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...
python
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", ")", ":", "if", "hasattr", "(", "self", ".", "mgfile", ".", "info", ",", "'bitrate'", ")", "and", "self", ".", "mgfile", ".", "info", ".", "bitrate", ":", "# Many formats provide it explicitly.", "return", "self", ".", "mgfil...
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...
[ "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...
aa13755155977b4776e49f79984f9968ac1d74dc
https://github.com/Josef-Friedrich/phrydy/blob/aa13755155977b4776e49f79984f9968ac1d74dc/phrydy/mediafile.py#L2189-L2207
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
fromfits
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()...
python
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", ")", ":", "pixelarray", ",", "hdr", "=", "pyfits", ".", "getdata", "(", "infilename", ",", "hdu", ",", "header", "=", "True", ")", "pixelarray", "=", "np", ".", ...
Reads a FITS file and returns a 2D numpy array of the data. Use hdu to specify which HDU you want (default = primary = 0)
[ "Reads", "a", "FITS", "file", "and", "returns", "a", "2D", "numpy", "array", "of", "the", "data", ".", "Use", "hdu", "to", "specify", "which", "HDU", "you", "want", "(", "default", "=", "primary", "=", "0", ")" ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L639-L654
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
tofits
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. ...
python
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", ")", ":", "pixelarrayshape", "=", "pixelarray", ".", "shape", "if", "verbose", ":", "print", "\"FITS export shape : (%i, %i)\"", "%", "(", "pixelarray...
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...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L656-L680
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
subsample
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...
python
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 ...", "\"\"\"\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...
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.
[ "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", ":", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L685-L709
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
rebin2x2
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)
python
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", ")", ":", "inshape", "=", "np", ".", "array", "(", "a", ".", "shape", ")", "if", "not", "(", "inshape", "%", "2", "==", "np", ".", "zeros", "(", "2", ")", ")", ".", "all", "(", ")", ":", "# Modulo check to see if size...
Wrapper around rebin that actually rebins 2 by 2
[ "Wrapper", "around", "rebin", "that", "actually", "rebins", "2", "by", "2" ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L734-L742
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.labelmask
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...
python
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", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Labeling mask pixels ...\"", "# We morphologicaly dilate the mask to generously conn...
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.
[ "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...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L154-L185
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.getdilatedmask
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,...
python
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", ")", ":", "if", "size", "==", "3", ":", "dilmask", "=", "ndimage", ".", "morphology", ".", "binary_dilation", "(", "self", ".", "mask", ",", "structure", "=", "growkernel", ",", "iterations", ...
Returns a morphologically dilated copy of the current mask. size = 3 or 5 decides how to dilate.
[ "Returns", "a", "morphologically", "dilated", "copy", "of", "the", "current", "mask", ".", "size", "=", "3", "or", "5", "decides", "how", "to", "dilate", "." ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L188-L200
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.clean
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... ...
python
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", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "mask", "==", "None", ":", "mask", "=", "self", ".", "mask", "if", "ve...
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 ...
[ "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...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L203-L294
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.findsatstars
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...
python
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", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Detecting saturated stars ...\"", "# DETECTION", "satpixels", "=", "self", ...
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 ...
[ "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...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L296-L351
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.getsatstars
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...
python
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", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "not", "self", ".", "satlevel", ">", "0", ":", "raise", "RuntimeError", ",", "\"Cannot determine s...
Returns the mask of saturated stars after finding them if not yet done. Intended mainly for external use.
[ "Returns", "the", "mask", "of", "saturated", "stars", "after", "finding", "them", "if", "not", "yet", "done", ".", "Intended", "mainly", "for", "external", "use", "." ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L353-L364
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.guessbackgroundlevel
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
python
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", ")", ":", "if", "self", ".", "backgroundlevel", "==", "None", ":", "self", ".", "backgroundlevel", "=", "np", ".", "median", "(", "self", ".", "rawarray", ".", "ravel", "(", ")", ")", "return", "self", ".", "...
Estimates the background level. This could be used to fill pixels in large cosmics.
[ "Estimates", "the", "background", "level", ".", "This", "could", "be", "used", "to", "fill", "pixels", "in", "large", "cosmics", "." ]
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L382-L388
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.lacosmiciteration
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 ...
python
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", ")", ":", "if", "verbose", "==", "None", ":", "verbose", "=", "self", ".", "verbose", "if", "verbose", ":", "print", "\"Convolving image with Laplacian kernel ...\"", "# We subsample, convolve, cl...
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...
[ "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"...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L391-L531
train
Vital-Fernandez/dazer
bin/lib/Astro_Libraries/cosmics.py
cosmicsimage.run
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...
python
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", ")", ":", "if", "self", ".", "satlevel", ">", "0", "and", "self", ".", "satstars", "==", "None", ":", "self", ".", "findsatstars", "(", "verbose", "=", "True", ")", ...
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.
[ "Full", "artillery", ":", "-", ")", "-", "Find", "saturated", "stars", "-", "Run", "maxiter", "L", ".", "A", ".", "Cosmic", "iterations", "(", "stops", "if", "no", "more", "cosmics", "are", "found", ")", "Stops", "if", "no", "cosmics", "are", "found", ...
3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244
https://github.com/Vital-Fernandez/dazer/blob/3c9ae8ae6d40ea33f22cc20dc11365d6d6e65244/bin/lib/Astro_Libraries/cosmics.py#L591-L617
train
shotastage/mirage-django-lts
mirage/proj/environ.py
MirageEnvironment.search_project_root
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(): ...
python
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", "(", ")", ":", "while", "True", ":", "current", "=", "os", ".", "getcwd", "(", ")", "if", "pathlib", ".", "Path", "(", "\"Miragefile.py\"", ")", ".", "is_file", "(", ")", "or", "pathlib", ".", "Path", "(", "\"Miragefile\"", ...
Search your Django project root. returns: - path:string Django project root path
[ "Search", "your", "Django", "project", "root", "." ]
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L61-L78
train
shotastage/mirage-django-lts
mirage/proj/environ.py
MirageEnvironment.search_app_root
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...
python
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", "(", ")", ":", "while", "True", ":", "current", "=", "os", ".", "getcwd", "(", ")", "if", "pathlib", ".", "Path", "(", "\"apps.py\"", ")", ".", "is_file", "(", ")", ":", "return", "current", "elif", "pathlib", ".", "Path", "...
Search your Django application root returns: - (String) Django application root path
[ "Search", "your", "Django", "application", "root" ]
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L81-L97
train
shotastage/mirage-django-lts
mirage/proj/environ.py
MirageEnvironment.in_app
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")...
python
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", ":", "try", ":", "MirageEnvironment", ".", "set_import_root", "(", ")", "import", "apps", "if", "os", ".", "path", ".", "isfile", "(", "\"apps.py\"", ")", ":", "return", "True", "else", ":", "return", "False", "...
Judge where current working directory is in Django application or not. returns: - (Bool) cwd is in app dir returns True
[ "Judge", "where", "current", "working", "directory", "is", "in", "Django", "application", "or", "not", "." ]
4e32dd48fff4b191abb90813ce3cc5ef0654a2ab
https://github.com/shotastage/mirage-django-lts/blob/4e32dd48fff4b191abb90813ce3cc5ef0654a2ab/mirage/proj/environ.py#L137-L154
train
kajala/django-jutil
jutil/cache.py
update_cached_fields
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__'...
python
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", ")", ":", "for", "a", "in", "args", ":", "if", "a", "is", "not", "None", ":", "if", "hasattr", "(", "a", ",", "'__iter__'", ")", ":", "for", "e", "in", "a", ":", "e", ".", "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
[ "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",...
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/cache.py#L49-L62
train
kajala/django-jutil
jutil/cache.py
CachedFieldsMixin.update_cached_fields_pre_save
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...
python
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", ")", ":", "if", "self", ".", "id", "and", "update_fields", "is", "None", ":", "self", ".", "update_cached_fields", "(", "commit", "=", "False", ",", "exceptions", "=", "F...
Call on pre_save signal for objects (to automatically refresh on save). :param update_fields: list of fields to update
[ "Call", "on", "pre_save", "signal", "for", "objects", "(", "to", "automatically", "refresh", "on", "save", ")", ".", ":", "param", "update_fields", ":", "list", "of", "fields", "to", "update" ]
2abd93ebad51042744eaeb1ee1074ed0eb55ad0c
https://github.com/kajala/django-jutil/blob/2abd93ebad51042744eaeb1ee1074ed0eb55ad0c/jutil/cache.py#L40-L46
train
novopl/peltak
src/peltak/extra/gitflow/logic/hotfix.py
start
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...
python
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", "hotfix_branch", "=", "'hotfix/'", "+", "common", ".", "to_branch_name", "(", "name", ")", "master", "=", "conf", ".", "get", "(", "'git.master_branch'", ",", "'master'", ")", "common", ".", "as...
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.
[ "Start", "working", "on", "a", "new", "hotfix", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L30-L44
train
novopl/peltak
src/peltak/extra/gitflow/logic/hotfix.py
finish
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 ...
python
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", "pretend", "=", "context", ".", "get", "(", "'pretend'", ",", "False", ")", "if", "not", "pretend", "and", "(", "git", ".", "staged", "(", ")", "or", "git", ".", "unstaged", "(", ")", ")", ":", ...
Merge current feature into develop.
[ "Merge", "current", "feature", "into", "develop", "." ]
b627acc019e3665875fe76cdca0a14773b69beaa
https://github.com/novopl/peltak/blob/b627acc019e3665875fe76cdca0a14773b69beaa/src/peltak/extra/gitflow/logic/hotfix.py#L76-L108
train