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
3 values
summary
stringlengths
4
350
biosignalsnotebooks/biosignalsnotebooks
biosignalsnotebooks/biosignalsnotebooks/old/_factory.py
notebook.write_to_file
def write_to_file(self, path, filename): """ Class method responsible for generating a file containing the notebook object data. ---------- Parameters ---------- path : str biosignalsnotebooks Root folder path (where the notebook will be stored). fil...
python
def write_to_file(self, path, filename): """ Class method responsible for generating a file containing the notebook object data. ---------- Parameters ---------- path : str biosignalsnotebooks Root folder path (where the notebook will be stored). fil...
[ "def", "write_to_file", "(", "self", ",", "path", ",", "filename", ")", ":", "# =============================== Storage of Filename ======================================", "self", ".", "filename", "=", "filename", "categories_path", "=", "_generate_dir_structure", "(", "path...
Class method responsible for generating a file containing the notebook object data. ---------- Parameters ---------- path : str biosignalsnotebooks Root folder path (where the notebook will be stored). filename : str Defines the name of the notebook file...
[ "Class", "method", "responsible", "for", "generating", "a", "file", "containing", "the", "notebook", "object", "data", "." ]
aaa01d4125180b3a34f1e26e0d3ff08c23f666d3
https://github.com/biosignalsnotebooks/biosignalsnotebooks/blob/aaa01d4125180b3a34f1e26e0d3ff08c23f666d3/biosignalsnotebooks/biosignalsnotebooks/old/_factory.py#L141-L174
train
This method writes the notebook object to a file.
sontek/bulby
bulby/color.py
in_lamp_reach
def in_lamp_reach(p): ''' Check if the provided XYPoint can be recreated by a Hue lamp. ''' v1 = XYPoint(Lime.x - Red.x, Lime.y - Red.y) v2 = XYPoint(Blue.x - Red.x, Blue.y - Red.y) q = XYPoint(p.x - Red.x, p.y - Red.y) s = cross_product(q, v2) / cross_product(v1, v2) t = cross_product(v1, q) /...
python
def in_lamp_reach(p): ''' Check if the provided XYPoint can be recreated by a Hue lamp. ''' v1 = XYPoint(Lime.x - Red.x, Lime.y - Red.y) v2 = XYPoint(Blue.x - Red.x, Blue.y - Red.y) q = XYPoint(p.x - Red.x, p.y - Red.y) s = cross_product(q, v2) / cross_product(v1, v2) t = cross_product(v1, q) /...
[ "def", "in_lamp_reach", "(", "p", ")", ":", "v1", "=", "XYPoint", "(", "Lime", ".", "x", "-", "Red", ".", "x", ",", "Lime", ".", "y", "-", "Red", ".", "y", ")", "v2", "=", "XYPoint", "(", "Blue", ".", "x", "-", "Red", ".", "x", ",", "Blue",...
Check if the provided XYPoint can be recreated by a Hue lamp.
[ "Check", "if", "the", "provided", "XYPoint", "can", "be", "recreated", "by", "a", "Hue", "lamp", "." ]
a2e741f843ee8e361b50a6079601108bfbe52526
https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L18-L27
train
Check if the provided XYPoint can be recreated by a Hue lamp.
sontek/bulby
bulby/color.py
get_closest_point_to_line
def get_closest_point_to_line(A, B, P): ''' Find the closest point on a line. This point will be reproducible by a Hue lamp. ''' AP = XYPoint(P.x - A.x, P.y - A.y) AB = XYPoint(B.x - A.x, B.y - A.y) ab2 = AB.x * AB.x + AB.y * AB.y ap_ab = AP.x * AB.x + AP.y * AB.y t = ap_ab / ab2 ...
python
def get_closest_point_to_line(A, B, P): ''' Find the closest point on a line. This point will be reproducible by a Hue lamp. ''' AP = XYPoint(P.x - A.x, P.y - A.y) AB = XYPoint(B.x - A.x, B.y - A.y) ab2 = AB.x * AB.x + AB.y * AB.y ap_ab = AP.x * AB.x + AP.y * AB.y t = ap_ab / ab2 ...
[ "def", "get_closest_point_to_line", "(", "A", ",", "B", ",", "P", ")", ":", "AP", "=", "XYPoint", "(", "P", ".", "x", "-", "A", ".", "x", ",", "P", ".", "y", "-", "A", ".", "y", ")", "AB", "=", "XYPoint", "(", "B", ".", "x", "-", "A", "."...
Find the closest point on a line. This point will be reproducible by a Hue lamp.
[ "Find", "the", "closest", "point", "on", "a", "line", ".", "This", "point", "will", "be", "reproducible", "by", "a", "Hue", "lamp", "." ]
a2e741f843ee8e361b50a6079601108bfbe52526
https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L30-L46
train
Find the closest point to a line.
sontek/bulby
bulby/color.py
get_closest_point_to_point
def get_closest_point_to_point(xy_point): ''' Used to find the closest point to an unreproducible Color is unreproducible on each line in the CIE 1931 'triangle'. ''' pAB = get_closest_point_to_line(Red, Lime, xy_point) pAC = get_closest_point_to_line(Blue, Red, xy_point) pBC = get_closest_p...
python
def get_closest_point_to_point(xy_point): ''' Used to find the closest point to an unreproducible Color is unreproducible on each line in the CIE 1931 'triangle'. ''' pAB = get_closest_point_to_line(Red, Lime, xy_point) pAC = get_closest_point_to_line(Blue, Red, xy_point) pBC = get_closest_p...
[ "def", "get_closest_point_to_point", "(", "xy_point", ")", ":", "pAB", "=", "get_closest_point_to_line", "(", "Red", ",", "Lime", ",", "xy_point", ")", "pAC", "=", "get_closest_point_to_line", "(", "Blue", ",", "Red", ",", "xy_point", ")", "pBC", "=", "get_clo...
Used to find the closest point to an unreproducible Color is unreproducible on each line in the CIE 1931 'triangle'.
[ "Used", "to", "find", "the", "closest", "point", "to", "an", "unreproducible", "Color", "is", "unreproducible", "on", "each", "line", "in", "the", "CIE", "1931", "triangle", "." ]
a2e741f843ee8e361b50a6079601108bfbe52526
https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L58-L87
train
Returns the closest point to a point in the unreproducible Color.
sontek/bulby
bulby/color.py
get_xy_from_hex
def get_xy_from_hex(hex_value): ''' Returns X, Y coordinates containing the closest avilable CIE 1931 based on the hex_value provided. ''' red, green, blue = struct.unpack('BBB', codecs.decode(hex_value, 'hex')) r = ((red + 0.055) / (1.0 + 0.055)) ** 2.4 if (red > 0.04045) else (red / 12.92) # ...
python
def get_xy_from_hex(hex_value): ''' Returns X, Y coordinates containing the closest avilable CIE 1931 based on the hex_value provided. ''' red, green, blue = struct.unpack('BBB', codecs.decode(hex_value, 'hex')) r = ((red + 0.055) / (1.0 + 0.055)) ** 2.4 if (red > 0.04045) else (red / 12.92) # ...
[ "def", "get_xy_from_hex", "(", "hex_value", ")", ":", "red", ",", "green", ",", "blue", "=", "struct", ".", "unpack", "(", "'BBB'", ",", "codecs", ".", "decode", "(", "hex_value", ",", "'hex'", ")", ")", "r", "=", "(", "(", "red", "+", "0.055", ")"...
Returns X, Y coordinates containing the closest avilable CIE 1931 based on the hex_value provided.
[ "Returns", "X", "Y", "coordinates", "containing", "the", "closest", "avilable", "CIE", "1931", "based", "on", "the", "hex_value", "provided", "." ]
a2e741f843ee8e361b50a6079601108bfbe52526
https://github.com/sontek/bulby/blob/a2e741f843ee8e361b50a6079601108bfbe52526/bulby/color.py#L90-L117
train
Returns the closest avilable CIE 1931 XY point based on the hex_value provided.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.get_other_keys
def get_other_keys(self, key, including_current=False): """ Returns list of other keys that are mapped to the same value as specified key. @param key - key for which other keys should be returned. @param including_current if set to True - key will also appear on this list.""" ...
python
def get_other_keys(self, key, including_current=False): """ Returns list of other keys that are mapped to the same value as specified key. @param key - key for which other keys should be returned. @param including_current if set to True - key will also appear on this list.""" ...
[ "def", "get_other_keys", "(", "self", ",", "key", ",", "including_current", "=", "False", ")", ":", "other_keys", "=", "[", "]", "if", "key", "in", "self", ":", "other_keys", ".", "extend", "(", "self", ".", "__dict__", "[", "str", "(", "type", "(", ...
Returns list of other keys that are mapped to the same value as specified key. @param key - key for which other keys should be returned. @param including_current if set to True - key will also appear on this list.
[ "Returns", "list", "of", "other", "keys", "that", "are", "mapped", "to", "the", "same", "value", "as", "specified", "key", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L167-L176
train
Returns a list of other keys that are mapped to the same value as specified key.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.iteritems
def iteritems(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's (key, value) pairs. @param key_type if specified, iterator will be returning only (key,value) pairs for this type of key. Otherwise (if not specified) ((keys,...), value) ...
python
def iteritems(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's (key, value) pairs. @param key_type if specified, iterator will be returning only (key,value) pairs for this type of key. Otherwise (if not specified) ((keys,...), value) ...
[ "def", "iteritems", "(", "self", ",", "key_type", "=", "None", ",", "return_all_keys", "=", "False", ")", ":", "if", "key_type", "is", "None", ":", "for", "item", "in", "self", ".", "items_dict", ".", "items", "(", ")", ":", "yield", "item", "return", ...
Returns an iterator over the dictionary's (key, value) pairs. @param key_type if specified, iterator will be returning only (key,value) pairs for this type of key. Otherwise (if not specified) ((keys,...), value) i.e. (tuple of keys, values) pairs for all items in t...
[ "Returns", "an", "iterator", "over", "the", "dictionary", "s", "(", "key", "value", ")", "pairs", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L178-L199
train
Returns an iterator over the items of the object.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.iterkeys
def iterkeys(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys ...
python
def iterkeys(self, key_type=None, return_all_keys=False): """ Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys ...
[ "def", "iterkeys", "(", "self", ",", "key_type", "=", "None", ",", "return_all_keys", "=", "False", ")", ":", "if", "(", "key_type", "is", "not", "None", ")", ":", "the_key", "=", "str", "(", "key_type", ")", "if", "the_key", "in", "self", ".", "__di...
Returns an iterator over the dictionary's keys. @param key_type if specified, iterator for a dictionary of this type will be used. Otherwise (if not specified) tuples containing all (multiple) keys for this dictionary will be generated. @param return_al...
[ "Returns", "an", "iterator", "over", "the", "dictionary", "s", "keys", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L201-L217
train
Returns an iterator over the keys of the object.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.itervalues
def itervalues(self, key_type=None): """ Returns an iterator over the dictionary's values. @param key_type if specified, iterator will be returning only values pointed by keys of this type. Otherwise (if not specified) all values in this dictinary will be generated.""" ...
python
def itervalues(self, key_type=None): """ Returns an iterator over the dictionary's values. @param key_type if specified, iterator will be returning only values pointed by keys of this type. Otherwise (if not specified) all values in this dictinary will be generated.""" ...
[ "def", "itervalues", "(", "self", ",", "key_type", "=", "None", ")", ":", "if", "(", "key_type", "is", "not", "None", ")", ":", "intermediate_key", "=", "str", "(", "key_type", ")", "if", "intermediate_key", "in", "self", ".", "__dict__", ":", "for", "...
Returns an iterator over the dictionary's values. @param key_type if specified, iterator will be returning only values pointed by keys of this type. Otherwise (if not specified) all values in this dictinary will be generated.
[ "Returns", "an", "iterator", "over", "the", "dictionary", "s", "values", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L219-L230
train
Returns an iterator over the dictionary s values.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.keys
def keys(self, key_type=None): """ Returns a copy of the dictionary's keys. @param key_type if specified, only keys for this type will be returned. Otherwise list of tuples containing all (multiple) keys will be returned.""" if key_type is not None: intermed...
python
def keys(self, key_type=None): """ Returns a copy of the dictionary's keys. @param key_type if specified, only keys for this type will be returned. Otherwise list of tuples containing all (multiple) keys will be returned.""" if key_type is not None: intermed...
[ "def", "keys", "(", "self", ",", "key_type", "=", "None", ")", ":", "if", "key_type", "is", "not", "None", ":", "intermediate_key", "=", "str", "(", "key_type", ")", "if", "intermediate_key", "in", "self", ".", "__dict__", ":", "return", "self", ".", "...
Returns a copy of the dictionary's keys. @param key_type if specified, only keys for this type will be returned. Otherwise list of tuples containing all (multiple) keys will be returned.
[ "Returns", "a", "copy", "of", "the", "dictionary", "s", "keys", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L239-L251
train
Returns a copy of the dictionary s keys.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.values
def values(self, key_type=None): """ Returns a copy of the dictionary's values. @param key_type if specified, only values pointed by keys of this type will be returned. Otherwise list of all values contained in this dictionary will be returned.""" if(key_type is not None...
python
def values(self, key_type=None): """ Returns a copy of the dictionary's values. @param key_type if specified, only values pointed by keys of this type will be returned. Otherwise list of all values contained in this dictionary will be returned.""" if(key_type is not None...
[ "def", "values", "(", "self", ",", "key_type", "=", "None", ")", ":", "if", "(", "key_type", "is", "not", "None", ")", ":", "all_items", "=", "{", "}", "# in order to preserve keys() type (dict_values for python3) \r", "keys_used", "=", "set", "(", ")", "direc...
Returns a copy of the dictionary's values. @param key_type if specified, only values pointed by keys of this type will be returned. Otherwise list of all values contained in this dictionary will be returned.
[ "Returns", "a", "copy", "of", "the", "dictionary", "s", "values", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L253-L268
train
Returns a copy of the dictionary s values.
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.__add_item
def __add_item(self, item, keys=None): """ Internal method to add an item to the multi-key dictionary""" if(not keys or not len(keys)): raise Exception('Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tuple/list containing at least one key!' ...
python
def __add_item(self, item, keys=None): """ Internal method to add an item to the multi-key dictionary""" if(not keys or not len(keys)): raise Exception('Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tuple/list containing at least one key!' ...
[ "def", "__add_item", "(", "self", ",", "item", ",", "keys", "=", "None", ")", ":", "if", "(", "not", "keys", "or", "not", "len", "(", "keys", ")", ")", ":", "raise", "Exception", "(", "'Error in %s.__add_item(%s, keys=tuple/list of items): need to specify a tupl...
Internal method to add an item to the multi-key dictionary
[ "Internal", "method", "to", "add", "an", "item", "to", "the", "multi", "-", "key", "dictionary" ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L277-L294
train
Add an item to the multi - key dictionary
formiaczek/multi_key_dict
multi_key_dict.py
multi_key_dict.get
def get(self, key, default=None): """ Return the value at index specified as key.""" if key in self: return self.items_dict[self.__dict__[str(type(key))][key]] else: return default
python
def get(self, key, default=None): """ Return the value at index specified as key.""" if key in self: return self.items_dict[self.__dict__[str(type(key))][key]] else: return default
[ "def", "get", "(", "self", ",", "key", ",", "default", "=", "None", ")", ":", "if", "key", "in", "self", ":", "return", "self", ".", "items_dict", "[", "self", ".", "__dict__", "[", "str", "(", "type", "(", "key", ")", ")", "]", "[", "key", "]"...
Return the value at index specified as key.
[ "Return", "the", "value", "at", "index", "specified", "as", "key", "." ]
320826cadad8ae8664042c627fa90f82ecd7b6b7
https://github.com/formiaczek/multi_key_dict/blob/320826cadad8ae8664042c627fa90f82ecd7b6b7/multi_key_dict.py#L296-L301
train
Return the value at the specified index as key.
adamziel/django_translate
django_translate/extractors/django_template.py
DjangoTemplateExtractor.extract_translations
def extract_translations(self, string): """Extract messages from Django template string.""" trans = [] for t in Lexer(string.decode("utf-8"), None).tokenize(): if t.token_type == TOKEN_BLOCK: if not t.contents.startswith( (self.tranz_tag, self...
python
def extract_translations(self, string): """Extract messages from Django template string.""" trans = [] for t in Lexer(string.decode("utf-8"), None).tokenize(): if t.token_type == TOKEN_BLOCK: if not t.contents.startswith( (self.tranz_tag, self...
[ "def", "extract_translations", "(", "self", ",", "string", ")", ":", "trans", "=", "[", "]", "for", "t", "in", "Lexer", "(", "string", ".", "decode", "(", "\"utf-8\"", ")", ",", "None", ")", ".", "tokenize", "(", ")", ":", "if", "t", ".", "token_ty...
Extract messages from Django template string.
[ "Extract", "messages", "from", "Django", "template", "string", "." ]
43d8ef94a5c230abbdc89f3dbc623313fde998f2
https://github.com/adamziel/django_translate/blob/43d8ef94a5c230abbdc89f3dbc623313fde998f2/django_translate/extractors/django_template.py#L32-L58
train
Extract messages from Django template string.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.next
def next(self): """Returns the next marker. Returns: tuple: The marker name as a string and its genotypes as a :py:class:`numpy.ndarray`. """ if self._mode != "r": raise UnsupportedOperation("not available in 'w' mode") self._n += 1 ...
python
def next(self): """Returns the next marker. Returns: tuple: The marker name as a string and its genotypes as a :py:class:`numpy.ndarray`. """ if self._mode != "r": raise UnsupportedOperation("not available in 'w' mode") self._n += 1 ...
[ "def", "next", "(", "self", ")", ":", "if", "self", ".", "_mode", "!=", "\"r\"", ":", "raise", "UnsupportedOperation", "(", "\"not available in 'w' mode\"", ")", "self", ".", "_n", "+=", "1", "if", "self", ".", "_n", ">", "self", ".", "_nb_markers", ":",...
Returns the next marker. Returns: tuple: The marker name as a string and its genotypes as a :py:class:`numpy.ndarray`.
[ "Returns", "the", "next", "marker", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L181-L196
train
Returns the next marker name as a string and its genotypes as numpy. ndarray.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._read_current_marker
def _read_current_marker(self): """Reads the current marker and returns its genotypes.""" return self._geno_values[ np.frombuffer(self._bed.read(self._nb_bytes), dtype=np.uint8) ].flatten(order="C")[:self._nb_samples]
python
def _read_current_marker(self): """Reads the current marker and returns its genotypes.""" return self._geno_values[ np.frombuffer(self._bed.read(self._nb_bytes), dtype=np.uint8) ].flatten(order="C")[:self._nb_samples]
[ "def", "_read_current_marker", "(", "self", ")", ":", "return", "self", ".", "_geno_values", "[", "np", ".", "frombuffer", "(", "self", ".", "_bed", ".", "read", "(", "self", ".", "_nb_bytes", ")", ",", "dtype", "=", "np", ".", "uint8", ")", "]", "."...
Reads the current marker and returns its genotypes.
[ "Reads", "the", "current", "marker", "and", "returns", "its", "genotypes", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L198-L202
train
Reads the current marker and returns its genotypes.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.seek
def seek(self, n): """Gets to a certain marker position in the BED file. Args: n (int): The index of the marker to seek to. """ if self._mode != "r": raise UnsupportedOperation("not available in 'w' mode") if 0 <= n < self._nb_markers: self....
python
def seek(self, n): """Gets to a certain marker position in the BED file. Args: n (int): The index of the marker to seek to. """ if self._mode != "r": raise UnsupportedOperation("not available in 'w' mode") if 0 <= n < self._nb_markers: self....
[ "def", "seek", "(", "self", ",", "n", ")", ":", "if", "self", ".", "_mode", "!=", "\"r\"", ":", "raise", "UnsupportedOperation", "(", "\"not available in 'w' mode\"", ")", "if", "0", "<=", "n", "<", "self", ".", "_nb_markers", ":", "self", ".", "_n", "...
Gets to a certain marker position in the BED file. Args: n (int): The index of the marker to seek to.
[ "Gets", "to", "a", "certain", "marker", "position", "in", "the", "BED", "file", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L204-L220
train
Gets to a certain marker in the BED file.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._read_bim
def _read_bim(self): """Reads the BIM file.""" # Reading the BIM file and setting the values bim = pd.read_csv(self.bim_filename, delim_whitespace=True, names=["chrom", "snp", "cm", "pos", "a1", "a2"], dtype=dict(snp=str, a1=str, a2=str)) ...
python
def _read_bim(self): """Reads the BIM file.""" # Reading the BIM file and setting the values bim = pd.read_csv(self.bim_filename, delim_whitespace=True, names=["chrom", "snp", "cm", "pos", "a1", "a2"], dtype=dict(snp=str, a1=str, a2=str)) ...
[ "def", "_read_bim", "(", "self", ")", ":", "# Reading the BIM file and setting the values", "bim", "=", "pd", ".", "read_csv", "(", "self", ".", "bim_filename", ",", "delim_whitespace", "=", "True", ",", "names", "=", "[", "\"chrom\"", ",", "\"snp\"", ",", "\"...
Reads the BIM file.
[ "Reads", "the", "BIM", "file", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L231-L295
train
Reads the BIM file and sets the internal _has_duplicated flag to True.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._read_fam
def _read_fam(self): """Reads the FAM file.""" # Reading the FAM file and setting the values fam = pd.read_csv(self.fam_filename, delim_whitespace=True, names=["fid", "iid", "father", "mother", "gender", "status"], ...
python
def _read_fam(self): """Reads the FAM file.""" # Reading the FAM file and setting the values fam = pd.read_csv(self.fam_filename, delim_whitespace=True, names=["fid", "iid", "father", "mother", "gender", "status"], ...
[ "def", "_read_fam", "(", "self", ")", ":", "# Reading the FAM file and setting the values", "fam", "=", "pd", ".", "read_csv", "(", "self", ".", "fam_filename", ",", "delim_whitespace", "=", "True", ",", "names", "=", "[", "\"fid\"", ",", "\"iid\"", ",", "\"fa...
Reads the FAM file.
[ "Reads", "the", "FAM", "file", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L333-L349
train
Reads the FAM file and sets the object self. _fam and self. _nb_samples attributes.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._read_bed
def _read_bed(self): """Reads the BED file.""" # Checking if BIM and BAM files were both read if (self._bim is None) or (self._fam is None): raise RuntimeError("no BIM or FAM file were read") # The number of bytes per marker self._nb_bytes = int(np.ceil(self._nb_samp...
python
def _read_bed(self): """Reads the BED file.""" # Checking if BIM and BAM files were both read if (self._bim is None) or (self._fam is None): raise RuntimeError("no BIM or FAM file were read") # The number of bytes per marker self._nb_bytes = int(np.ceil(self._nb_samp...
[ "def", "_read_bed", "(", "self", ")", ":", "# Checking if BIM and BAM files were both read", "if", "(", "self", ".", "_bim", "is", "None", ")", "or", "(", "self", ".", "_fam", "is", "None", ")", ":", "raise", "RuntimeError", "(", "\"no BIM or FAM file were read\...
Reads the BED file.
[ "Reads", "the", "BED", "file", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L375-L408
train
Reads the BED file and stores the metadata in self. _bed.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._write_bed_header
def _write_bed_header(self): """Writes the BED first 3 bytes.""" # Writing the first three bytes final_byte = 1 if self._bed_format == "SNP-major" else 0 self._bed.write(bytearray((108, 27, final_byte)))
python
def _write_bed_header(self): """Writes the BED first 3 bytes.""" # Writing the first three bytes final_byte = 1 if self._bed_format == "SNP-major" else 0 self._bed.write(bytearray((108, 27, final_byte)))
[ "def", "_write_bed_header", "(", "self", ")", ":", "# Writing the first three bytes", "final_byte", "=", "1", "if", "self", ".", "_bed_format", "==", "\"SNP-major\"", "else", "0", "self", ".", "_bed", ".", "write", "(", "bytearray", "(", "(", "108", ",", "27...
Writes the BED first 3 bytes.
[ "Writes", "the", "BED", "first", "3", "bytes", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L410-L414
train
Writes the BED header.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.iter_acgt_geno
def iter_acgt_geno(self): """Iterates over genotypes (ACGT format). Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.ndarray` (ACGT format). """ # Need to iterate over itself, and modify the actual genotypes for...
python
def iter_acgt_geno(self): """Iterates over genotypes (ACGT format). Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.ndarray` (ACGT format). """ # Need to iterate over itself, and modify the actual genotypes for...
[ "def", "iter_acgt_geno", "(", "self", ")", ":", "# Need to iterate over itself, and modify the actual genotypes", "for", "i", ",", "(", "marker", ",", "geno", ")", "in", "enumerate", "(", "self", ".", "iter_geno", "(", ")", ")", ":", "yield", "marker", ",", "s...
Iterates over genotypes (ACGT format). Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.ndarray` (ACGT format).
[ "Iterates", "over", "genotypes", "(", "ACGT", "format", ")", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L433-L443
train
Iterates over the genotypes of the a .
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.iter_geno_marker
def iter_geno_marker(self, markers, return_index=False): """Iterates over genotypes for a list of markers. Args: markers (list): The list of markers to iterate onto. return_index (bool): Wether to return the marker's index or not. Returns: tuple: The name of...
python
def iter_geno_marker(self, markers, return_index=False): """Iterates over genotypes for a list of markers. Args: markers (list): The list of markers to iterate onto. return_index (bool): Wether to return the marker's index or not. Returns: tuple: The name of...
[ "def", "iter_geno_marker", "(", "self", ",", "markers", ",", "return_index", "=", "False", ")", ":", "if", "self", ".", "_mode", "!=", "\"r\"", ":", "raise", "UnsupportedOperation", "(", "\"not available in 'w' mode\"", ")", "# If string, we change to list", "if", ...
Iterates over genotypes for a list of markers. Args: markers (list): The list of markers to iterate onto. return_index (bool): Wether to return the marker's index or not. Returns: tuple: The name of the marker as a string, and its genotypes as a :py:clas...
[ "Iterates", "over", "genotypes", "for", "a", "list", "of", "markers", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L445-L471
train
Iterates over genotypes for a list of markers.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.iter_acgt_geno_marker
def iter_acgt_geno_marker(self, markers): """Iterates over genotypes for a list of markers (ACGT format). Args: markers (list): The list of markers to iterate onto. Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.n...
python
def iter_acgt_geno_marker(self, markers): """Iterates over genotypes for a list of markers (ACGT format). Args: markers (list): The list of markers to iterate onto. Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.n...
[ "def", "iter_acgt_geno_marker", "(", "self", ",", "markers", ")", ":", "# We iterate over the markers", "for", "snp", ",", "geno", ",", "s", "in", "self", ".", "iter_geno_marker", "(", "markers", ",", "return_index", "=", "True", ")", ":", "# Getting the SNP pos...
Iterates over genotypes for a list of markers (ACGT format). Args: markers (list): The list of markers to iterate onto. Returns: tuple: The name of the marker as a string, and its genotypes as a :py:class:`numpy.ndarray` (ACGT format).
[ "Iterates", "over", "genotypes", "for", "a", "list", "of", "markers", "(", "ACGT", "format", ")", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L473-L487
train
Iterate over the genotypes of the specified markers and return the corresponding tuple.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.get_geno_marker
def get_geno_marker(self, marker, return_index=False): """Gets the genotypes for a given marker. Args: marker (str): The name of the marker. return_index (bool): Wether to return the marker's index or not. Returns: numpy.ndarray: The genotypes of the marker ...
python
def get_geno_marker(self, marker, return_index=False): """Gets the genotypes for a given marker. Args: marker (str): The name of the marker. return_index (bool): Wether to return the marker's index or not. Returns: numpy.ndarray: The genotypes of the marker ...
[ "def", "get_geno_marker", "(", "self", ",", "marker", ",", "return_index", "=", "False", ")", ":", "if", "self", ".", "_mode", "!=", "\"r\"", ":", "raise", "UnsupportedOperation", "(", "\"not available in 'w' mode\"", ")", "# Check if the marker exists", "if", "ma...
Gets the genotypes for a given marker. Args: marker (str): The name of the marker. return_index (bool): Wether to return the marker's index or not. Returns: numpy.ndarray: The genotypes of the marker (additive format).
[ "Gets", "the", "genotypes", "for", "a", "given", "marker", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L489-L513
train
Returns the genotypes of a given marker.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.get_acgt_geno_marker
def get_acgt_geno_marker(self, marker): """Gets the genotypes for a given marker (ACGT format). Args: marker (str): The name of the marker. Returns: numpy.ndarray: The genotypes of the marker (ACGT format). """ # Getting the marker's genotypes g...
python
def get_acgt_geno_marker(self, marker): """Gets the genotypes for a given marker (ACGT format). Args: marker (str): The name of the marker. Returns: numpy.ndarray: The genotypes of the marker (ACGT format). """ # Getting the marker's genotypes g...
[ "def", "get_acgt_geno_marker", "(", "self", ",", "marker", ")", ":", "# Getting the marker's genotypes", "geno", ",", "snp_position", "=", "self", ".", "get_geno_marker", "(", "marker", ",", "return_index", "=", "True", ")", "# Returning the ACGT's format of the genotyp...
Gets the genotypes for a given marker (ACGT format). Args: marker (str): The name of the marker. Returns: numpy.ndarray: The genotypes of the marker (ACGT format).
[ "Gets", "the", "genotypes", "for", "a", "given", "marker", "(", "ACGT", "format", ")", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L515-L529
train
Gets the genotypes of an ACGT marker.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink.write_genotypes
def write_genotypes(self, genotypes): """Write genotypes to binary file. Args: genotypes (numpy.ndarray): The genotypes to write in the BED file. """ if self._mode != "w": raise UnsupportedOperation("not available in 'r' mode") # Initializing the number...
python
def write_genotypes(self, genotypes): """Write genotypes to binary file. Args: genotypes (numpy.ndarray): The genotypes to write in the BED file. """ if self._mode != "w": raise UnsupportedOperation("not available in 'r' mode") # Initializing the number...
[ "def", "write_genotypes", "(", "self", ",", "genotypes", ")", ":", "if", "self", ".", "_mode", "!=", "\"w\"", ":", "raise", "UnsupportedOperation", "(", "\"not available in 'r' mode\"", ")", "# Initializing the number of samples if required", "if", "self", ".", "_nb_v...
Write genotypes to binary file. Args: genotypes (numpy.ndarray): The genotypes to write in the BED file.
[ "Write", "genotypes", "to", "binary", "file", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L531-L557
train
Writes the genotypes to the BED file.
lemieuxl/pyplink
pyplink/pyplink.py
PyPlink._grouper
def _grouper(iterable, n, fillvalue=0): """Collect data into fixed-length chunks or blocks. Args: n (int): The size of the chunk. fillvalue (int): The fill value. Returns: iterator: An iterator over the chunks. """ args = [iter(iterable)] * ...
python
def _grouper(iterable, n, fillvalue=0): """Collect data into fixed-length chunks or blocks. Args: n (int): The size of the chunk. fillvalue (int): The fill value. Returns: iterator: An iterator over the chunks. """ args = [iter(iterable)] * ...
[ "def", "_grouper", "(", "iterable", ",", "n", ",", "fillvalue", "=", "0", ")", ":", "args", "=", "[", "iter", "(", "iterable", ")", "]", "*", "n", "return", "zip_longest", "(", "fillvalue", "=", "fillvalue", ",", "*", "args", ")" ]
Collect data into fixed-length chunks or blocks. Args: n (int): The size of the chunk. fillvalue (int): The fill value. Returns: iterator: An iterator over the chunks.
[ "Collect", "data", "into", "fixed", "-", "length", "chunks", "or", "blocks", "." ]
31d47c86f589064bda98206314a2d0b20e7fd2f0
https://github.com/lemieuxl/pyplink/blob/31d47c86f589064bda98206314a2d0b20e7fd2f0/pyplink/pyplink.py#L560-L572
train
Group data into fixed - length chunks or blocks.
CI-WATER/gsshapy
gsshapy/orm/tim.py
TimeSeriesFile._read
def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None): """ Generic Time Series Read from File Method """ # Assign file extension attribute to file object self.fileExtension = extension timeSerie...
python
def _read(self, directory, filename, session, path, name, extension, spatial=None, spatialReferenceID=None, replaceParamFile=None): """ Generic Time Series Read from File Method """ # Assign file extension attribute to file object self.fileExtension = extension timeSerie...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", "=", "None", ",", "spatialReferenceID", "=", "None", ",", "replaceParamFile", "=", "None", ")", ":", "# Assign file ...
Generic Time Series Read from File Method
[ "Generic", "Time", "Series", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L60-L82
train
Generic Time Series Read from File Method
CI-WATER/gsshapy
gsshapy/orm/tim.py
TimeSeriesFile._write
def _write(self, session, openFile, replaceParamFile): """ Generic Time Series Write to File Method """ # Retrieve all time series timeSeries = self.timeSeries # Num TimeSeries numTS = len(timeSeries) # Transform into list of dictionaries for pivot tool ...
python
def _write(self, session, openFile, replaceParamFile): """ Generic Time Series Write to File Method """ # Retrieve all time series timeSeries = self.timeSeries # Num TimeSeries numTS = len(timeSeries) # Transform into list of dictionaries for pivot tool ...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "# Retrieve all time series", "timeSeries", "=", "self", ".", "timeSeries", "# Num TimeSeries", "numTS", "=", "len", "(", "timeSeries", ")", "# Transform into list of d...
Generic Time Series Write to File Method
[ "Generic", "Time", "Series", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L84-L121
train
Generic Time Series Write to File Method
CI-WATER/gsshapy
gsshapy/orm/tim.py
TimeSeriesFile.as_dataframe
def as_dataframe(self): """ Return time series as pandas dataframe """ time_series = {} for ts_index, ts in enumerate(self.timeSeries): index = [] data = [] for value in ts.values: index.append(value.simTime) dat...
python
def as_dataframe(self): """ Return time series as pandas dataframe """ time_series = {} for ts_index, ts in enumerate(self.timeSeries): index = [] data = [] for value in ts.values: index.append(value.simTime) dat...
[ "def", "as_dataframe", "(", "self", ")", ":", "time_series", "=", "{", "}", "for", "ts_index", ",", "ts", "in", "enumerate", "(", "self", ".", "timeSeries", ")", ":", "index", "=", "[", "]", "data", "=", "[", "]", "for", "value", "in", "ts", ".", ...
Return time series as pandas dataframe
[ "Return", "time", "series", "as", "pandas", "dataframe" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/tim.py#L123-L135
train
Return time series as pandas dataframe
vinci1it2000/schedula
schedula/utils/blue.py
Blueprint.register
def register(self, obj=None, memo=None): """ Creates a :class:`Blueprint.cls` and calls each deferred operation. :param obj: The initialized object with which to call all deferred operations. :type obj: object :param memo: A dictionary to cache registere...
python
def register(self, obj=None, memo=None): """ Creates a :class:`Blueprint.cls` and calls each deferred operation. :param obj: The initialized object with which to call all deferred operations. :type obj: object :param memo: A dictionary to cache registere...
[ "def", "register", "(", "self", ",", "obj", "=", "None", ",", "memo", "=", "None", ")", ":", "if", "memo", "and", "self", "in", "memo", ":", "obj", "=", "memo", "[", "self", "]", "if", "obj", "is", "not", "None", ":", "return", "obj", "if", "ob...
Creates a :class:`Blueprint.cls` and calls each deferred operation. :param obj: The initialized object with which to call all deferred operations. :type obj: object :param memo: A dictionary to cache registered Blueprints. :type memo: dict[Blueprint,T] ...
[ "Creates", "a", ":", "class", ":", "Blueprint", ".", "cls", "and", "calls", "each", "deferred", "operation", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L49-L87
train
Creates a new Blueprint. cls and calls each deferred operation.
vinci1it2000/schedula
schedula/utils/blue.py
Blueprint.extend
def extend(self, *blues, memo=None): """ Extends deferred operations calling each operation of given Blueprints. :param blues: Blueprints or Dispatchers to extend deferred operations. :type blues: Blueprint | schedula.dispatcher.Dispatcher :param memo: A...
python
def extend(self, *blues, memo=None): """ Extends deferred operations calling each operation of given Blueprints. :param blues: Blueprints or Dispatchers to extend deferred operations. :type blues: Blueprint | schedula.dispatcher.Dispatcher :param memo: A...
[ "def", "extend", "(", "self", ",", "*", "blues", ",", "memo", "=", "None", ")", ":", "memo", "=", "{", "}", "if", "memo", "is", "None", "else", "memo", "for", "blue", "in", "blues", ":", "if", "isinstance", "(", "blue", ",", "Dispatcher", ")", ":...
Extends deferred operations calling each operation of given Blueprints. :param blues: Blueprints or Dispatchers to extend deferred operations. :type blues: Blueprint | schedula.dispatcher.Dispatcher :param memo: A dictionary to cache Blueprints. :type memo: dict...
[ "Extends", "deferred", "operations", "calling", "each", "operation", "of", "given", "Blueprints", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L89-L123
train
Extends this object with the given Blueprints or Dispatchers.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.add_data
def add_data(self, data_id=None, default_value=EMPTY, initial_dist=0.0, wait_inputs=False, wildcard=None, function=None, callback=None, description=None, filters=None, await_result=None, **kwargs): """ Add a single data node to the dispatcher. :param data_id: ...
python
def add_data(self, data_id=None, default_value=EMPTY, initial_dist=0.0, wait_inputs=False, wildcard=None, function=None, callback=None, description=None, filters=None, await_result=None, **kwargs): """ Add a single data node to the dispatcher. :param data_id: ...
[ "def", "add_data", "(", "self", ",", "data_id", "=", "None", ",", "default_value", "=", "EMPTY", ",", "initial_dist", "=", "0.0", ",", "wait_inputs", "=", "False", ",", "wildcard", "=", "None", ",", "function", "=", "None", ",", "callback", "=", "None", ...
Add a single data node to the dispatcher. :param data_id: Data node id. If None will be assigned automatically ('unknown<%d>') not in dmap. :type data_id: str, optional :param default_value: Data node default value. This will be used as input if it is not ...
[ "Add", "a", "single", "data", "node", "to", "the", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L218-L289
train
This method adds a single data node to the dispatcher.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.add_function
def add_function(self, function_id=None, function=None, inputs=None, outputs=None, input_domain=None, weight=None, inp_weight=None, out_weight=None, description=None, filters=None, await_domain=None, await_result=None, **kwargs): ...
python
def add_function(self, function_id=None, function=None, inputs=None, outputs=None, input_domain=None, weight=None, inp_weight=None, out_weight=None, description=None, filters=None, await_domain=None, await_result=None, **kwargs): ...
[ "def", "add_function", "(", "self", ",", "function_id", "=", "None", ",", "function", "=", "None", ",", "inputs", "=", "None", ",", "outputs", "=", "None", ",", "input_domain", "=", "None", ",", "weight", "=", "None", ",", "inp_weight", "=", "None", ",...
Add a single function node to dispatcher. :param function_id: Function node id. If None will be assigned as <fun.__name__>. :type function_id: str, optional :param function: Data node estimation function. :type function: callable, optional :...
[ "Add", "a", "single", "function", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L291-L369
train
This method adds a function node to the dispatcher.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.add_func
def add_func(self, function, outputs=None, weight=None, inputs_kwargs=False, inputs_defaults=False, filters=None, input_domain=None, await_domain=None, await_result=None, inp_weight=None, out_weight=None, description=None, inputs=None, function_id=None...
python
def add_func(self, function, outputs=None, weight=None, inputs_kwargs=False, inputs_defaults=False, filters=None, input_domain=None, await_domain=None, await_result=None, inp_weight=None, out_weight=None, description=None, inputs=None, function_id=None...
[ "def", "add_func", "(", "self", ",", "function", ",", "outputs", "=", "None", ",", "weight", "=", "None", ",", "inputs_kwargs", "=", "False", ",", "inputs_defaults", "=", "False", ",", "filters", "=", "None", ",", "input_domain", "=", "None", ",", "await...
Add a single function node to dispatcher. :param inputs_kwargs: Do you want to include kwargs as inputs? :type inputs_kwargs: bool :param inputs_defaults: Do you want to set default values? :type inputs_defaults: bool :param function_id: Fun...
[ "Add", "a", "single", "function", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L371-L462
train
Adds a function to the dispatcher.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.add_dispatcher
def add_dispatcher(self, dsp, inputs, outputs, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, **kwargs): """ Add a single sub-dispatcher node to dispatcher. ...
python
def add_dispatcher(self, dsp, inputs, outputs, dsp_id=None, input_domain=None, weight=None, inp_weight=None, description=None, include_defaults=False, await_domain=None, **kwargs): """ Add a single sub-dispatcher node to dispatcher. ...
[ "def", "add_dispatcher", "(", "self", ",", "dsp", ",", "inputs", ",", "outputs", ",", "dsp_id", "=", "None", ",", "input_domain", "=", "None", ",", "weight", "=", "None", ",", "inp_weight", "=", "None", ",", "description", "=", "None", ",", "include_defa...
Add a single sub-dispatcher node to dispatcher. :param dsp: Child dispatcher that is added as sub-dispatcher node to the parent dispatcher. :type dsp: Dispatcher | dict[str, list] :param inputs: Inputs mapping. Data node ids from parent dispatcher to child ...
[ "Add", "a", "single", "sub", "-", "dispatcher", "node", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L464-L540
train
This method adds a single sub - dispatcher node to the dispatcher.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.add_from_lists
def add_from_lists(self, data_list=None, fun_list=None, dsp_list=None): """ Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is ...
python
def add_from_lists(self, data_list=None, fun_list=None, dsp_list=None): """ Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is ...
[ "def", "add_from_lists", "(", "self", ",", "data_list", "=", "None", ",", "fun_list", "=", "None", ",", "dsp_list", "=", "None", ")", ":", "self", ".", "deferred", ".", "append", "(", "(", "'add_from_lists'", ",", "_call_kw", "(", "locals", "(", ")", "...
Add multiple function and data nodes to dispatcher. :param data_list: It is a list of data node kwargs to be loaded. :type data_list: list[dict], optional :param fun_list: It is a list of function node kwargs to be loaded. :type fun_list: list[dict], optional ...
[ "Add", "multiple", "function", "and", "data", "nodes", "to", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L542-L563
train
Add multiple function and data nodes to dispatcher.
vinci1it2000/schedula
schedula/utils/blue.py
BlueDispatcher.set_default_value
def set_default_value(self, data_id, value=EMPTY, initial_dist=0.0): """ Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the...
python
def set_default_value(self, data_id, value=EMPTY, initial_dist=0.0): """ Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the...
[ "def", "set_default_value", "(", "self", ",", "data_id", ",", "value", "=", "EMPTY", ",", "initial_dist", "=", "0.0", ")", ":", "self", ".", "deferred", ".", "append", "(", "(", "'set_default_value'", ",", "_call_kw", "(", "locals", "(", ")", ")", ")", ...
Set the default value of a data node in the dispatcher. :param data_id: Data node id. :type data_id: str :param value: Data node default value. .. note:: If `EMPTY` the previous default value is removed. :type value: T, optional :param init...
[ "Set", "the", "default", "value", "of", "a", "data", "node", "in", "the", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/blue.py#L565-L589
train
Set the default value of a data node in the dispatcher.
CI-WATER/gsshapy
gsshapy/orm/loc.py
OutputLocationFile._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Generic Output Location Read from File Method """ # Assign file extension attribute to file object self.fileExtension = extension # Open file and pars...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Generic Output Location Read from File Method """ # Assign file extension attribute to file object self.fileExtension = extension # Open file and pars...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":", "# Assign file extension attribute to file object", "self", "....
Generic Output Location Read from File Method
[ "Generic", "Output", "Location", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/loc.py#L61-L81
train
Generic Output Location Read from File Method
CI-WATER/gsshapy
gsshapy/orm/loc.py
OutputLocationFile._write
def _write(self, session, openFile, replaceParamFile): """ Generic Output Location Write to File Method """ # Retrieve output locations locations = self.outputLocations # Write lines openFile.write('%s\n' % self.numLocations) for location in locations: ...
python
def _write(self, session, openFile, replaceParamFile): """ Generic Output Location Write to File Method """ # Retrieve output locations locations = self.outputLocations # Write lines openFile.write('%s\n' % self.numLocations) for location in locations: ...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "# Retrieve output locations", "locations", "=", "self", ".", "outputLocations", "# Write lines", "openFile", ".", "write", "(", "'%s\\n'", "%", "self", ".", "numLo...
Generic Output Location Write to File Method
[ "Generic", "Output", "Location", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/loc.py#L83-L95
train
Generic Output Location Write to File Method
vinci1it2000/schedula
schedula/utils/base.py
Base.web
def web(self, depth=-1, node_data=NONE, node_function=NONE, directory=None, sites=None, run=True): """ Creates a dispatcher Flask app. :param depth: Depth of sub-dispatch plots. If negative all levels are plotted. :type depth: int, optional :param node_d...
python
def web(self, depth=-1, node_data=NONE, node_function=NONE, directory=None, sites=None, run=True): """ Creates a dispatcher Flask app. :param depth: Depth of sub-dispatch plots. If negative all levels are plotted. :type depth: int, optional :param node_d...
[ "def", "web", "(", "self", ",", "depth", "=", "-", "1", ",", "node_data", "=", "NONE", ",", "node_function", "=", "NONE", ",", "directory", "=", "None", ",", "sites", "=", "None", ",", "run", "=", "True", ")", ":", "options", "=", "{", "'node_data'...
Creates a dispatcher Flask app. :param depth: Depth of sub-dispatch plots. If negative all levels are plotted. :type depth: int, optional :param node_data: Data node attributes to view. :type node_data: tuple[str], optional :param node_function: ...
[ "Creates", "a", "dispatcher", "Flask", "app", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/base.py#L27-L109
train
Creates a web server that will serve the node data and function nodes.
vinci1it2000/schedula
schedula/utils/base.py
Base.plot
def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE, format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE, node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE, node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE, max_w...
python
def plot(self, workflow=None, view=True, depth=-1, name=NONE, comment=NONE, format=NONE, engine=NONE, encoding=NONE, graph_attr=NONE, node_attr=NONE, edge_attr=NONE, body=NONE, node_styles=NONE, node_data=NONE, node_function=NONE, edge_data=NONE, max_lines=NONE, max_w...
[ "def", "plot", "(", "self", ",", "workflow", "=", "None", ",", "view", "=", "True", ",", "depth", "=", "-", "1", ",", "name", "=", "NONE", ",", "comment", "=", "NONE", ",", "format", "=", "NONE", ",", "engine", "=", "NONE", ",", "encoding", "=", ...
Plots the Dispatcher with a graph in the DOT language with Graphviz. :param workflow: If True the latest solution will be plotted, otherwise the dmap. :type workflow: bool, optional :param view: Open the rendered directed graph in the DOT language with the sys ...
[ "Plots", "the", "Dispatcher", "with", "a", "graph", "in", "the", "DOT", "language", "with", "Graphviz", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/base.py#L111-L265
train
Plot the dispatcher with a graphviz graph.
vinci1it2000/schedula
schedula/utils/base.py
Base.get_node
def get_node(self, *node_ids, node_attr=NONE): """ Returns a sub node of a dispatcher. :param node_ids: A sequence of node ids or a single node id. The id order identifies a dispatcher sub-level. :type node_ids: str :param node_attr: Output n...
python
def get_node(self, *node_ids, node_attr=NONE): """ Returns a sub node of a dispatcher. :param node_ids: A sequence of node ids or a single node id. The id order identifies a dispatcher sub-level. :type node_ids: str :param node_attr: Output n...
[ "def", "get_node", "(", "self", ",", "*", "node_ids", ",", "node_attr", "=", "NONE", ")", ":", "kw", "=", "{", "}", "from", ".", "sol", "import", "Solution", "if", "node_attr", "is", "NONE", ":", "node_attr", "=", "'output'", "if", "isinstance", "(", ...
Returns a sub node of a dispatcher. :param node_ids: A sequence of node ids or a single node id. The id order identifies a dispatcher sub-level. :type node_ids: str :param node_attr: Output node attr. If the searched node does not have this attr...
[ "Returns", "a", "sub", "node", "of", "a", "dispatcher", "." ]
addb9fd685be81544b796c51383ac00a31543ce9
https://github.com/vinci1it2000/schedula/blob/addb9fd685be81544b796c51383ac00a31543ce9/schedula/utils/base.py#L267-L352
train
This method returns a sub - node of a dispatcher.
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._api_get
def _api_get(self, url, **kwargs): """ A convenience wrapper for _get. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
python
def _api_get(self, url, **kwargs): """ A convenience wrapper for _get. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
[ "def", "_api_get", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'url'", "]", "=", "self", ".", "url", "+", "url", "kwargs", "[", "'auth'", "]", "=", "self", ".", "auth", "headers", "=", "deepcopy", "(", "self", ".",...
A convenience wrapper for _get. Adds headers, auth and base url by default
[ "A", "convenience", "wrapper", "for", "_get", ".", "Adds", "headers", "auth", "and", "base", "url", "by", "default" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L36-L47
train
A convenience wrapper for _get. Adds headers auth and base url by default
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._get
def _get(self, *args, **kwargs): """ A wrapper for getting things :returns: The response of your get :rtype: dict """ response = requests.get(*args, **kwargs) response.raise_for_status() return response.json()
python
def _get(self, *args, **kwargs): """ A wrapper for getting things :returns: The response of your get :rtype: dict """ response = requests.get(*args, **kwargs) response.raise_for_status() return response.json()
[ "def", "_get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "requests", ".", "get", "(", "*", "args", ",", "*", "*", "kwargs", ")", "response", ".", "raise_for_status", "(", ")", "return", "response", ".", "jso...
A wrapper for getting things :returns: The response of your get :rtype: dict
[ "A", "wrapper", "for", "getting", "things" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L49-L60
train
A wrapper for getting the dict of the get items
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._api_put
def _api_put(self, url, **kwargs): """ A convenience wrapper for _put. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
python
def _api_put(self, url, **kwargs): """ A convenience wrapper for _put. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
[ "def", "_api_put", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'url'", "]", "=", "self", ".", "url", "+", "url", "kwargs", "[", "'auth'", "]", "=", "self", ".", "auth", "headers", "=", "deepcopy", "(", "self", ".",...
A convenience wrapper for _put. Adds headers, auth and base url by default
[ "A", "convenience", "wrapper", "for", "_put", ".", "Adds", "headers", "auth", "and", "base", "url", "by", "default" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L62-L73
train
A convenience wrapper for _put. Adds headers auth and base url by default
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._put
def _put(self, *args, **kwargs): """ A wrapper for putting things. It will also json encode your 'data' parameter :returns: The response of your put :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = requests....
python
def _put(self, *args, **kwargs): """ A wrapper for putting things. It will also json encode your 'data' parameter :returns: The response of your put :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = requests....
[ "def", "_put", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'data'", "in", "kwargs", ":", "kwargs", "[", "'data'", "]", "=", "json", ".", "dumps", "(", "kwargs", "[", "'data'", "]", ")", "response", "=", "requests", "....
A wrapper for putting things. It will also json encode your 'data' parameter :returns: The response of your put :rtype: dict
[ "A", "wrapper", "for", "putting", "things", ".", "It", "will", "also", "json", "encode", "your", "data", "parameter" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L75-L85
train
Wrapper for put
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._api_post
def _api_post(self, url, **kwargs): """ A convenience wrapper for _post. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
python
def _api_post(self, url, **kwargs): """ A convenience wrapper for _post. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})) ...
[ "def", "_api_post", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'url'", "]", "=", "self", ".", "url", "+", "url", "kwargs", "[", "'auth'", "]", "=", "self", ".", "auth", "headers", "=", "deepcopy", "(", "self", "."...
A convenience wrapper for _post. Adds headers, auth and base url by default
[ "A", "convenience", "wrapper", "for", "_post", ".", "Adds", "headers", "auth", "and", "base", "url", "by", "default" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L87-L98
train
A convenience wrapper for _post. Adds headers auth and base url by default
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._post
def _post(self, *args, **kwargs): """ A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = request...
python
def _post(self, *args, **kwargs): """ A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict """ if 'data' in kwargs: kwargs['data'] = json.dumps(kwargs['data']) response = request...
[ "def", "_post", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'data'", "in", "kwargs", ":", "kwargs", "[", "'data'", "]", "=", "json", ".", "dumps", "(", "kwargs", "[", "'data'", "]", ")", "response", "=", "requests", "...
A wrapper for posting things. It will also json encode your 'data' parameter :returns: The response of your post :rtype: dict
[ "A", "wrapper", "for", "posting", "things", ".", "It", "will", "also", "json", "encode", "your", "data", "parameter" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L100-L110
train
Wrapper for requests. post
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._api_delete
def _api_delete(self, url, **kwargs): """ A convenience wrapper for _delete. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})...
python
def _api_delete(self, url, **kwargs): """ A convenience wrapper for _delete. Adds headers, auth and base url by default """ kwargs['url'] = self.url + url kwargs['auth'] = self.auth headers = deepcopy(self.headers) headers.update(kwargs.get('headers', {})...
[ "def", "_api_delete", "(", "self", ",", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'url'", "]", "=", "self", ".", "url", "+", "url", "kwargs", "[", "'auth'", "]", "=", "self", ".", "auth", "headers", "=", "deepcopy", "(", "self", "...
A convenience wrapper for _delete. Adds headers, auth and base url by default
[ "A", "convenience", "wrapper", "for", "_delete", ".", "Adds", "headers", "auth", "and", "base", "url", "by", "default" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L112-L123
train
A convenience wrapper for _delete. Adds headers auth and base url by default
ambitioninc/rabbitmq-admin
rabbitmq_admin/base.py
Resource._delete
def _delete(self, *args, **kwargs): """ A wrapper for deleting things :returns: The response of your delete :rtype: dict """ response = requests.delete(*args, **kwargs) response.raise_for_status()
python
def _delete(self, *args, **kwargs): """ A wrapper for deleting things :returns: The response of your delete :rtype: dict """ response = requests.delete(*args, **kwargs) response.raise_for_status()
[ "def", "_delete", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "response", "=", "requests", ".", "delete", "(", "*", "args", ",", "*", "*", "kwargs", ")", "response", ".", "raise_for_status", "(", ")" ]
A wrapper for deleting things :returns: The response of your delete :rtype: dict
[ "A", "wrapper", "for", "deleting", "things" ]
ff65054115f19991da153f0e4f4e45e526545fea
https://github.com/ambitioninc/rabbitmq-admin/blob/ff65054115f19991da153f0e4f4e45e526545fea/rabbitmq_admin/base.py#L125-L133
train
A wrapper for deleting things
adamziel/django_translate
django_translate/services.py
discover_resources
def discover_resources(): """ Searches for translations files matching [catalog].[lang].[format] Traverses TRANZ_LOCALE_PATHS: - | TRANZ_LOCALE_PATHS +- messages.fr.yml | messages.en.yml And apps paths if TRANZ_SEARCH_LOCALE_IN_APPS is set to True): - | app_path +- TRANZ...
python
def discover_resources(): """ Searches for translations files matching [catalog].[lang].[format] Traverses TRANZ_LOCALE_PATHS: - | TRANZ_LOCALE_PATHS +- messages.fr.yml | messages.en.yml And apps paths if TRANZ_SEARCH_LOCALE_IN_APPS is set to True): - | app_path +- TRANZ...
[ "def", "discover_resources", "(", ")", ":", "locale_discovery_paths", "=", "list", "(", "settings", ".", "TRANZ_LOCALE_PATHS", ")", "if", "settings", ".", "TRANZ_SEARCH_LOCALE_IN_APPS", ":", "locale_discovery_paths", "+=", "[", "os", ".", "path", ".", "join", "(",...
Searches for translations files matching [catalog].[lang].[format] Traverses TRANZ_LOCALE_PATHS: - | TRANZ_LOCALE_PATHS +- messages.fr.yml | messages.en.yml And apps paths if TRANZ_SEARCH_LOCALE_IN_APPS is set to True): - | app_path +- TRANZ_DIR_NAME +- messages.fr.yml ...
[ "Searches", "for", "translations", "files", "matching", "[", "catalog", "]", ".", "[", "lang", "]", ".", "[", "format", "]" ]
43d8ef94a5c230abbdc89f3dbc623313fde998f2
https://github.com/adamziel/django_translate/blob/43d8ef94a5c230abbdc89f3dbc623313fde998f2/django_translate/services.py#L17-L70
train
Searches for translations files matching the locale paths and the apps paths.
CI-WATER/gsshapy
gsshapy/base/rast.py
RasterObjectBase.getAsKmlGrid
def getAsKmlGrid(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0, noDataValue=None): """ Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result is a vector grid of raster c...
python
def getAsKmlGrid(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0, noDataValue=None): """ Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result is a vector grid of raster c...
[ "def", "getAsKmlGrid", "(", "self", ",", "session", ",", "path", "=", "None", ",", "documentName", "=", "None", ",", "colorRamp", "=", "ColorRampEnum", ".", "COLOR_RAMP_HUE", ",", "alpha", "=", "1.0", ",", "noDataValue", "=", "None", ")", ":", "if", "typ...
Retrieve the raster as a KML document with each cell of the raster represented as a vector polygon. The result is a vector grid of raster cells. Cells with the no data value are excluded. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabl...
[ "Retrieve", "the", "raster", "as", "a", "KML", "document", "with", "each", "cell", "of", "the", "raster", "represented", "as", "a", "vector", "polygon", ".", "The", "result", "is", "a", "vector", "grid", "of", "raster", "cells", ".", "Cells", "with", "th...
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/rast.py#L33-L91
train
Returns the raster as a KML grid of the raster cells.
CI-WATER/gsshapy
gsshapy/base/rast.py
RasterObjectBase.getAsKmlPng
def getAsKmlPng(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0, noDataValue=None, drawOrder=0, cellSize=None, resampleMethod='NearestNeighbour'): """ Retrieve the raster as a PNG image ground overlay KML format. Coarse grid resolutions ...
python
def getAsKmlPng(self, session, path=None, documentName=None, colorRamp=ColorRampEnum.COLOR_RAMP_HUE, alpha=1.0, noDataValue=None, drawOrder=0, cellSize=None, resampleMethod='NearestNeighbour'): """ Retrieve the raster as a PNG image ground overlay KML format. Coarse grid resolutions ...
[ "def", "getAsKmlPng", "(", "self", ",", "session", ",", "path", "=", "None", ",", "documentName", "=", "None", ",", "colorRamp", "=", "ColorRampEnum", ".", "COLOR_RAMP_HUE", ",", "alpha", "=", "1.0", ",", "noDataValue", "=", "None", ",", "drawOrder", "=", ...
Retrieve the raster as a PNG image ground overlay KML format. Coarse grid resolutions must be resampled to smaller cell/pixel sizes to avoid a "fuzzy" look. Cells with the no data value are excluded. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to P...
[ "Retrieve", "the", "raster", "as", "a", "PNG", "image", "ground", "overlay", "KML", "format", ".", "Coarse", "grid", "resolutions", "must", "be", "resampled", "to", "smaller", "cell", "/", "pixel", "sizes", "to", "avoid", "a", "fuzzy", "look", ".", "Cells"...
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/rast.py#L153-L227
train
Returns the raster as a PNG image ground overlay KML file.
CI-WATER/gsshapy
gsshapy/base/rast.py
RasterObjectBase.getAsGrassAsciiGrid
def getAsGrassAsciiGrid(self, session): """ Retrieve the raster in the GRASS ASCII Grid format. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: str: GRASS ASCII string. """ ...
python
def getAsGrassAsciiGrid(self, session): """ Retrieve the raster in the GRASS ASCII Grid format. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: str: GRASS ASCII string. """ ...
[ "def", "getAsGrassAsciiGrid", "(", "self", ",", "session", ")", ":", "if", "type", "(", "self", ".", "raster", ")", "!=", "type", "(", "None", ")", ":", "# Make sure the raster field is valid", "converter", "=", "RasterConverter", "(", "sqlAlchemyEngineOrSession",...
Retrieve the raster in the GRASS ASCII Grid format. Args: session (:mod:`sqlalchemy.orm.session.Session`): SQLAlchemy session object bound to PostGIS enabled database. Returns: str: GRASS ASCII string.
[ "Retrieve", "the", "raster", "in", "the", "GRASS", "ASCII", "Grid", "format", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/base/rast.py#L229-L246
train
Retrieve the raster in the GRASS ASCII Grid format.
pedrotgn/pyactor
pyactor/context.py
set_context
def set_context(module_name='thread'): ''' This function initializes the context of execution deciding which type of threads are being used: classic python threads or green threads, provided by Gevent. This should be called first of all in every execution, otherwise, the library would not work....
python
def set_context(module_name='thread'): ''' This function initializes the context of execution deciding which type of threads are being used: classic python threads or green threads, provided by Gevent. This should be called first of all in every execution, otherwise, the library would not work....
[ "def", "set_context", "(", "module_name", "=", "'thread'", ")", ":", "global", "core_type", "if", "core_type", "is", "None", "and", "module_name", "in", "available_types", ":", "core_type", "=", "module_name", "util", ".", "core_type", "=", "core_type", "global"...
This function initializes the context of execution deciding which type of threads are being used: classic python threads or green threads, provided by Gevent. This should be called first of all in every execution, otherwise, the library would not work. The default module is 'thread'. :param s...
[ "This", "function", "initializes", "the", "context", "of", "execution", "deciding", "which", "type", "of", "threads", "are", "being", "used", ":", "classic", "python", "threads", "or", "green", "threads", "provided", "by", "Gevent", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L30-L72
train
This function initializes the context of the given module.
pedrotgn/pyactor
pyactor/context.py
create_host
def create_host(url="local://local:6666/host"): ''' This is the main function to create a new Host to which you can spawn actors. It will be set by default at local address if no parameter *url* is given, which would result in remote incomunication between hosts. This function shuould be called once...
python
def create_host(url="local://local:6666/host"): ''' This is the main function to create a new Host to which you can spawn actors. It will be set by default at local address if no parameter *url* is given, which would result in remote incomunication between hosts. This function shuould be called once...
[ "def", "create_host", "(", "url", "=", "\"local://local:6666/host\"", ")", ":", "if", "url", "in", "util", ".", "hosts", ".", "keys", "(", ")", ":", "raise", "HostError", "(", "'Host already created. Only one host can'", "+", "' be ran with the same url.'", ")", "...
This is the main function to create a new Host to which you can spawn actors. It will be set by default at local address if no parameter *url* is given, which would result in remote incomunication between hosts. This function shuould be called once for execution or after callig :meth:`~.shutdown` to the...
[ "This", "is", "the", "main", "function", "to", "create", "a", "new", "Host", "to", "which", "you", "can", "spawn", "actors", ".", "It", "will", "be", "set", "by", "default", "at", "local", "address", "if", "no", "parameter", "*", "url", "*", "is", "g...
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L75-L106
train
This function creates a new host that can be used to spawn actors from a remote host.
pedrotgn/pyactor
pyactor/context.py
shutdown
def shutdown(url=None): ''' Stops the Host passed by parameter or all of them if none is specified, stopping at the same time all its actors. Should be called at the end of its usage, to finish correctly all the connections and threads. ''' if url is None: for host in util.hosts.valu...
python
def shutdown(url=None): ''' Stops the Host passed by parameter or all of them if none is specified, stopping at the same time all its actors. Should be called at the end of its usage, to finish correctly all the connections and threads. ''' if url is None: for host in util.hosts.valu...
[ "def", "shutdown", "(", "url", "=", "None", ")", ":", "if", "url", "is", "None", ":", "for", "host", "in", "util", ".", "hosts", ".", "values", "(", ")", ":", "host", ".", "shutdown", "(", ")", "global", "core_type", "core_type", "=", "None", "else...
Stops the Host passed by parameter or all of them if none is specified, stopping at the same time all its actors. Should be called at the end of its usage, to finish correctly all the connections and threads.
[ "Stops", "the", "Host", "passed", "by", "parameter", "or", "all", "of", "them", "if", "none", "is", "specified", "stopping", "at", "the", "same", "time", "all", "its", "actors", ".", "Should", "be", "called", "at", "the", "end", "of", "its", "usage", "...
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L483-L497
train
Stops the Host passed by parameter or all of them if url is None.
pedrotgn/pyactor
pyactor/context.py
serve_forever
def serve_forever(): ''' This allows the host (main host) to keep alive indefinitely so its actors can receive queries at any time. The main thread stays blocked forever. To kill the execution, press Ctrl+C. See usage example in :ref:`sample6`. ''' if not util.main_host.alive: r...
python
def serve_forever(): ''' This allows the host (main host) to keep alive indefinitely so its actors can receive queries at any time. The main thread stays blocked forever. To kill the execution, press Ctrl+C. See usage example in :ref:`sample6`. ''' if not util.main_host.alive: r...
[ "def", "serve_forever", "(", ")", ":", "if", "not", "util", ".", "main_host", ".", "alive", ":", "raise", "Exception", "(", "\"This host is already shutted down.\"", ")", "util", ".", "main_host", ".", "serving", "=", "True", "signal", ".", "signal", "(", "S...
This allows the host (main host) to keep alive indefinitely so its actors can receive queries at any time. The main thread stays blocked forever. To kill the execution, press Ctrl+C. See usage example in :ref:`sample6`.
[ "This", "allows", "the", "host", "(", "main", "host", ")", "to", "keep", "alive", "indefinitely", "so", "its", "actors", "can", "receive", "queries", "at", "any", "time", ".", "The", "main", "thread", "stays", "blocked", "forever", ".", "To", "kill", "th...
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L513-L532
train
This function is used to serve a single node in a thread.
pedrotgn/pyactor
pyactor/context.py
interval
def interval(host, time, actor, method, *args, **kwargs): '''Creates an Event attached to the host for management that will execute the *method* of the *actor* every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: host that will manage the interval, commonly the host of t...
python
def interval(host, time, actor, method, *args, **kwargs): '''Creates an Event attached to the host for management that will execute the *method* of the *actor* every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: host that will manage the interval, commonly the host of t...
[ "def", "interval", "(", "host", ",", "time", ",", "actor", ",", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "call", "=", "getattr", "(", "actor", ",", "method", ",", "None", ")", "if", "not", "callable", "(", "call", ")", ":", ...
Creates an Event attached to the host for management that will execute the *method* of the *actor* every *time* seconds. See example in :ref:`sample_inter` :param Proxy host: host that will manage the interval, commonly the host of the actor. :param int time: seconds for the intervals. :pa...
[ "Creates", "an", "Event", "attached", "to", "the", "host", "for", "management", "that", "will", "execute", "the", "*", "method", "*", "of", "the", "*", "actor", "*", "every", "*", "time", "*", "seconds", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L535-L566
train
Creates an Event attached to the host for management that will manage the interval.
pedrotgn/pyactor
pyactor/context.py
later
def later(timeout, actor, method, *args, **kwargs): ''' Sets a timer that will call the *method* of the *actor* past *timeout* seconds. See example in :ref:`sample_inter` :param int timeout: seconds until the method is called. :param Proxy actor: actor to which make the call after *time* secon...
python
def later(timeout, actor, method, *args, **kwargs): ''' Sets a timer that will call the *method* of the *actor* past *timeout* seconds. See example in :ref:`sample_inter` :param int timeout: seconds until the method is called. :param Proxy actor: actor to which make the call after *time* secon...
[ "def", "later", "(", "timeout", ",", "actor", ",", "method", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "call", "=", "getattr", "(", "actor", ",", "method", ",", "None", ")", "if", "not", "callable", "(", "call", ")", ":", "raise", "Int...
Sets a timer that will call the *method* of the *actor* past *timeout* seconds. See example in :ref:`sample_inter` :param int timeout: seconds until the method is called. :param Proxy actor: actor to which make the call after *time* seconds. :param Str. method: method of the *actor* to be called. ...
[ "Sets", "a", "timer", "that", "will", "call", "the", "*", "method", "*", "of", "the", "*", "actor", "*", "past", "*", "timeout", "*", "seconds", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L569-L594
train
Sets a timer that will call the method of the actor after the given time.
pedrotgn/pyactor
pyactor/context.py
Host.load_transport
def load_transport(self, url): ''' For remote communication. Sets the communication dispatcher of the host at the address and port specified. The scheme must be http if using a XMLRPC dispatcher. amqp for RabbitMQ communications. This methos is internal. Automatically c...
python
def load_transport(self, url): ''' For remote communication. Sets the communication dispatcher of the host at the address and port specified. The scheme must be http if using a XMLRPC dispatcher. amqp for RabbitMQ communications. This methos is internal. Automatically c...
[ "def", "load_transport", "(", "self", ",", "url", ")", ":", "aurl", "=", "urlparse", "(", "url", ")", "addrl", "=", "aurl", ".", "netloc", ".", "split", "(", "':'", ")", "self", ".", "addr", "=", "addrl", "[", "0", "]", ",", "addrl", "[", "1", ...
For remote communication. Sets the communication dispatcher of the host at the address and port specified. The scheme must be http if using a XMLRPC dispatcher. amqp for RabbitMQ communications. This methos is internal. Automatically called when creating the host. :param str. ...
[ "For", "remote", "communication", ".", "Sets", "the", "communication", "dispatcher", "of", "the", "host", "at", "the", "address", "and", "port", "specified", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L152-L176
train
Load the transport and the host_url for remote communication.
pedrotgn/pyactor
pyactor/context.py
Host.spawn
def spawn(self, aid, klass, *param, **kparam): ''' This method creates an actor attached to this host. It will be an instance of the class *klass* and it will be assigned an ID that identifies it among the host. This method can be called remotely synchronously. :param s...
python
def spawn(self, aid, klass, *param, **kparam): ''' This method creates an actor attached to this host. It will be an instance of the class *klass* and it will be assigned an ID that identifies it among the host. This method can be called remotely synchronously. :param s...
[ "def", "spawn", "(", "self", ",", "aid", ",", "klass", ",", "*", "param", ",", "*", "*", "kparam", ")", ":", "if", "param", "is", "None", ":", "param", "=", "[", "]", "if", "not", "self", ".", "alive", ":", "raise", "HostDownError", "(", ")", "...
This method creates an actor attached to this host. It will be an instance of the class *klass* and it will be assigned an ID that identifies it among the host. This method can be called remotely synchronously. :param str. aid: identifier for the spawning actor. Unique within ...
[ "This", "method", "creates", "an", "actor", "attached", "to", "this", "host", ".", "It", "will", "be", "an", "instance", "of", "the", "class", "*", "klass", "*", "and", "it", "will", "be", "assigned", "an", "ID", "that", "identifies", "it", "among", "t...
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L178-L233
train
This method creates an actor attached to this host.
pedrotgn/pyactor
pyactor/context.py
Host.has_actor
def has_actor(self, aid): ''' Checks if the given id is used in the host by some actor. :param str. aid: identifier of the actor to check. :return: True if the id is used within the host. ''' url = '%s://%s/%s' % (self.transport, self.host_url.netloc, aid) return...
python
def has_actor(self, aid): ''' Checks if the given id is used in the host by some actor. :param str. aid: identifier of the actor to check. :return: True if the id is used within the host. ''' url = '%s://%s/%s' % (self.transport, self.host_url.netloc, aid) return...
[ "def", "has_actor", "(", "self", ",", "aid", ")", ":", "url", "=", "'%s://%s/%s'", "%", "(", "self", ".", "transport", ",", "self", ".", "host_url", ".", "netloc", ",", "aid", ")", "return", "url", "in", "self", ".", "actors", ".", "keys", "(", ")"...
Checks if the given id is used in the host by some actor. :param str. aid: identifier of the actor to check. :return: True if the id is used within the host.
[ "Checks", "if", "the", "given", "id", "is", "used", "in", "the", "host", "by", "some", "actor", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L235-L243
train
Checks if the given id is used within the host by some actor.
pedrotgn/pyactor
pyactor/context.py
Host.lookup
def lookup(self, aid): ''' Gets a new proxy that references to the actor of this host (only actors in this host) identified by the given ID. This method can be called remotely synchronously. :param str. aid: identifier of the actor you want. :return: :class:`~.Proxy` of...
python
def lookup(self, aid): ''' Gets a new proxy that references to the actor of this host (only actors in this host) identified by the given ID. This method can be called remotely synchronously. :param str. aid: identifier of the actor you want. :return: :class:`~.Proxy` of...
[ "def", "lookup", "(", "self", ",", "aid", ")", ":", "if", "not", "self", ".", "alive", ":", "raise", "HostDownError", "(", ")", "url", "=", "'%s://%s/%s'", "%", "(", "self", ".", "transport", ",", "self", ".", "host_url", ".", "netloc", ",", "aid", ...
Gets a new proxy that references to the actor of this host (only actors in this host) identified by the given ID. This method can be called remotely synchronously. :param str. aid: identifier of the actor you want. :return: :class:`~.Proxy` of the actor requiered. :raises: :cla...
[ "Gets", "a", "new", "proxy", "that", "references", "to", "the", "actor", "of", "this", "host", "(", "only", "actors", "in", "this", "host", ")", "identified", "by", "the", "given", "ID", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L245-L263
train
Gets a new proxy that references to the actor identified by the given ID.
pedrotgn/pyactor
pyactor/context.py
Host.stop_actor
def stop_actor(self, aid): ''' This method removes one actor from the Host, stoping it and deleting all its references. :param str. aid: identifier of the actor you want to stop. ''' url = '%s://%s/%s' % (self.transport, self.host_url.netloc, aid) if url != self....
python
def stop_actor(self, aid): ''' This method removes one actor from the Host, stoping it and deleting all its references. :param str. aid: identifier of the actor you want to stop. ''' url = '%s://%s/%s' % (self.transport, self.host_url.netloc, aid) if url != self....
[ "def", "stop_actor", "(", "self", ",", "aid", ")", ":", "url", "=", "'%s://%s/%s'", "%", "(", "self", ".", "transport", ",", "self", ".", "host_url", ".", "netloc", ",", "aid", ")", "if", "url", "!=", "self", ".", "url", ":", "actor", "=", "self", ...
This method removes one actor from the Host, stoping it and deleting all its references. :param str. aid: identifier of the actor you want to stop.
[ "This", "method", "removes", "one", "actor", "from", "the", "Host", "stoping", "it", "and", "deleting", "all", "its", "references", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L304-L317
train
This method stops one actor from the Host and deletes all its references.
pedrotgn/pyactor
pyactor/context.py
Host.lookup_url
def lookup_url(self, url, klass, module=None): ''' Gets a proxy reference to the actor indicated by the URL in the parameters. It can be a local reference or a remote direction to another host. This method can be called remotely synchronously. :param srt. url: address t...
python
def lookup_url(self, url, klass, module=None): ''' Gets a proxy reference to the actor indicated by the URL in the parameters. It can be a local reference or a remote direction to another host. This method can be called remotely synchronously. :param srt. url: address t...
[ "def", "lookup_url", "(", "self", ",", "url", ",", "klass", ",", "module", "=", "None", ")", ":", "if", "not", "self", ".", "alive", ":", "raise", "HostDownError", "(", ")", "aurl", "=", "urlparse", "(", "url", ")", "if", "self", ".", "is_local", "...
Gets a proxy reference to the actor indicated by the URL in the parameters. It can be a local reference or a remote direction to another host. This method can be called remotely synchronously. :param srt. url: address that identifies an actor. :param class klass: the class of t...
[ "Gets", "a", "proxy", "reference", "to", "the", "actor", "indicated", "by", "the", "URL", "in", "the", "parameters", ".", "It", "can", "be", "a", "local", "reference", "or", "a", "remote", "direction", "to", "another", "host", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L319-L373
train
Returns a proxy reference to the actor identified by the given URL.
pedrotgn/pyactor
pyactor/context.py
Host.dumps
def dumps(self, param): ''' Checks the parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host. ''' if isinstance(param, Proxy): module_name = param.actor.klass.__module__ ...
python
def dumps(self, param): ''' Checks the parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host. ''' if isinstance(param, Proxy): module_name = param.actor.klass.__module__ ...
[ "def", "dumps", "(", "self", ",", "param", ")", ":", "if", "isinstance", "(", "param", ",", "Proxy", ")", ":", "module_name", "=", "param", ".", "actor", ".", "klass", ".", "__module__", "filename", "=", "sys", ".", "modules", "[", "module_name", "]", ...
Checks the parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host.
[ "Checks", "the", "parameters", "generating", "new", "proxy", "instances", "to", "avoid", "query", "concurrences", "from", "shared", "proxies", "and", "creating", "proxies", "for", "actors", "from", "another", "host", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L419-L440
train
Dumps the parameters to avoid new proxies for the same object.
pedrotgn/pyactor
pyactor/context.py
Host.loads
def loads(self, param): ''' Checks the return parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host. ''' if isinstance(param, ProxyRef): try: return self.look...
python
def loads(self, param): ''' Checks the return parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host. ''' if isinstance(param, ProxyRef): try: return self.look...
[ "def", "loads", "(", "self", ",", "param", ")", ":", "if", "isinstance", "(", "param", ",", "ProxyRef", ")", ":", "try", ":", "return", "self", ".", "lookup_url", "(", "param", ".", "url", ",", "param", ".", "klass", ",", "param", ".", "module", ")...
Checks the return parameters generating new proxy instances to avoid query concurrences from shared proxies and creating proxies for actors from another host.
[ "Checks", "the", "return", "parameters", "generating", "new", "proxy", "instances", "to", "avoid", "query", "concurrences", "from", "shared", "proxies", "and", "creating", "proxies", "for", "actors", "from", "another", "host", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L442-L465
train
Checks the return parameters generating new proxy instances to avoid query concurrences from shared proxies and creating new proxy instances for actors from another host.
pedrotgn/pyactor
pyactor/context.py
Host.new_parallel
def new_parallel(self, function, *params): ''' Register a new thread executing a parallel method. ''' # Create a pool if not created (processes or Gevent...) if self.ppool is None: if core_type == 'thread': from multiprocessing.pool import ThreadPool ...
python
def new_parallel(self, function, *params): ''' Register a new thread executing a parallel method. ''' # Create a pool if not created (processes or Gevent...) if self.ppool is None: if core_type == 'thread': from multiprocessing.pool import ThreadPool ...
[ "def", "new_parallel", "(", "self", ",", "function", ",", "*", "params", ")", ":", "# Create a pool if not created (processes or Gevent...)", "if", "self", ".", "ppool", "is", "None", ":", "if", "core_type", "==", "'thread'", ":", "from", "multiprocessing", ".", ...
Register a new thread executing a parallel method.
[ "Register", "a", "new", "thread", "executing", "a", "parallel", "method", "." ]
24d98d134dd4228f2ba38e83611e9c3f50ec2fd4
https://github.com/pedrotgn/pyactor/blob/24d98d134dd4228f2ba38e83611e9c3f50ec2fd4/pyactor/context.py#L467-L480
train
Register a new thread executing a parallel method.
Pylons/plaster
src/plaster/uri.py
parse_uri
def parse_uri(config_uri): """ Parse the ``config_uri`` into a :class:`plaster.PlasterURL` object. ``config_uri`` can be a relative or absolute file path such as ``development.ini`` or ``/path/to/development.ini``. The file must have an extension that can be handled by a :class:`plaster.ILoader` ...
python
def parse_uri(config_uri): """ Parse the ``config_uri`` into a :class:`plaster.PlasterURL` object. ``config_uri`` can be a relative or absolute file path such as ``development.ini`` or ``/path/to/development.ini``. The file must have an extension that can be handled by a :class:`plaster.ILoader` ...
[ "def", "parse_uri", "(", "config_uri", ")", ":", "if", "isinstance", "(", "config_uri", ",", "PlasterURL", ")", ":", "return", "config_uri", "# force absolute paths to look like a uri for more accurate parsing", "# we throw away the dummy scheme later and parse it from the resolved...
Parse the ``config_uri`` into a :class:`plaster.PlasterURL` object. ``config_uri`` can be a relative or absolute file path such as ``development.ini`` or ``/path/to/development.ini``. The file must have an extension that can be handled by a :class:`plaster.ILoader` registered with the system. Alte...
[ "Parse", "the", "config_uri", "into", "a", ":", "class", ":", "plaster", ".", "PlasterURL", "object", "." ]
e70e55c182a8300d7ccf67e54d47740c72e72cd8
https://github.com/Pylons/plaster/blob/e70e55c182a8300d7ccf67e54d47740c72e72cd8/src/plaster/uri.py#L59-L125
train
Parse the supplied config_uri into a PlasterURL object.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpSession.recurse
def recurse(self, root_path, dir_cb, listing_cb, max_listing_size=0, max_depth=MAX_REMOTE_RECURSION_DEPTH): """Recursively iterate a directory. Invoke callbacks for directories and entries (both are optional, but it doesn't make sense unless one is provided). "max_listing_size...
python
def recurse(self, root_path, dir_cb, listing_cb, max_listing_size=0, max_depth=MAX_REMOTE_RECURSION_DEPTH): """Recursively iterate a directory. Invoke callbacks for directories and entries (both are optional, but it doesn't make sense unless one is provided). "max_listing_size...
[ "def", "recurse", "(", "self", ",", "root_path", ",", "dir_cb", ",", "listing_cb", ",", "max_listing_size", "=", "0", ",", "max_depth", "=", "MAX_REMOTE_RECURSION_DEPTH", ")", ":", "q", "=", "deque", "(", "[", "(", "root_path", ",", "0", ")", "]", ")", ...
Recursively iterate a directory. Invoke callbacks for directories and entries (both are optional, but it doesn't make sense unless one is provided). "max_listing_size" will allow for the file-listing to be chunked into manageable pieces. "max_depth" limited how deep recursion goes. T...
[ "Recursively", "iterate", "a", "directory", ".", "Invoke", "callbacks", "for", "directories", "and", "entries", "(", "both", "are", "optional", "but", "it", "doesn", "t", "make", "sense", "unless", "one", "is", "provided", ")", ".", "max_listing_size", "will",...
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L517-L568
train
Recursively iterate a directory and call a callback for directories and entries.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpSession.write_to_local
def write_to_local(self, filepath_from, filepath_to, mtime_dt=None): """Open a remote file and write it locally.""" self.__log.debug("Writing R[%s] -> L[%s]." % (filepath_from, filepath_to)) with SftpFile(self, filepath_from, 'r') as sf_fr...
python
def write_to_local(self, filepath_from, filepath_to, mtime_dt=None): """Open a remote file and write it locally.""" self.__log.debug("Writing R[%s] -> L[%s]." % (filepath_from, filepath_to)) with SftpFile(self, filepath_from, 'r') as sf_fr...
[ "def", "write_to_local", "(", "self", ",", "filepath_from", ",", "filepath_to", ",", "mtime_dt", "=", "None", ")", ":", "self", ".", "__log", ".", "debug", "(", "\"Writing R[%s] -> L[%s].\"", "%", "(", "filepath_from", ",", "filepath_to", ")", ")", "with", "...
Open a remote file and write it locally.
[ "Open", "a", "remote", "file", "and", "write", "it", "locally", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L570-L589
train
Open a remote file and write it locally.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpSession.write_to_remote
def write_to_remote(self, filepath_from, filepath_to, mtime_dt=None): """Open a local file and write it remotely.""" self.__log.debug("Writing L[%s] -> R[%s]." % (filepath_from, filepath_to)) with open(filepath_from, 'rb') as file_from: ...
python
def write_to_remote(self, filepath_from, filepath_to, mtime_dt=None): """Open a local file and write it remotely.""" self.__log.debug("Writing L[%s] -> R[%s]." % (filepath_from, filepath_to)) with open(filepath_from, 'rb') as file_from: ...
[ "def", "write_to_remote", "(", "self", ",", "filepath_from", ",", "filepath_to", ",", "mtime_dt", "=", "None", ")", ":", "self", ".", "__log", ".", "debug", "(", "\"Writing L[%s] -> R[%s].\"", "%", "(", "filepath_from", ",", "filepath_to", ")", ")", "with", ...
Open a local file and write it remotely.
[ "Open", "a", "local", "file", "and", "write", "it", "remotely", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L591-L609
train
Open a local file and write it remotely.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFile.__at_om_to_im
def __at_om_to_im(self, om): """Convert an "outer" access mode to an "inner" access mode. Returns a tuple of: (<system access mode>, <is append>, <is universal newlines>). """ original_om = om if om[0] == 'U': om = om[1:] is_um = Tru...
python
def __at_om_to_im(self, om): """Convert an "outer" access mode to an "inner" access mode. Returns a tuple of: (<system access mode>, <is append>, <is universal newlines>). """ original_om = om if om[0] == 'U': om = om[1:] is_um = Tru...
[ "def", "__at_om_to_im", "(", "self", ",", "om", ")", ":", "original_om", "=", "om", "if", "om", "[", "0", "]", "==", "'U'", ":", "om", "=", "om", "[", "1", ":", "]", "is_um", "=", "True", "else", ":", "is_um", "=", "False", "if", "om", "==", ...
Convert an "outer" access mode to an "inner" access mode. Returns a tuple of: (<system access mode>, <is append>, <is universal newlines>).
[ "Convert", "an", "outer", "access", "mode", "to", "an", "inner", "access", "mode", ".", "Returns", "a", "tuple", "of", ":" ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L664-L693
train
Convert an outer access mode to an inner access mode.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFile.open
def open(self): """This is the only way to open a file resource.""" self.__sf = _sftp_open(self.__sftp_session_int, self.__filepath, self.access_type_int, self.__create_mode) if self.access_type_is_...
python
def open(self): """This is the only way to open a file resource.""" self.__sf = _sftp_open(self.__sftp_session_int, self.__filepath, self.access_type_int, self.__create_mode) if self.access_type_is_...
[ "def", "open", "(", "self", ")", ":", "self", ".", "__sf", "=", "_sftp_open", "(", "self", ".", "__sftp_session_int", ",", "self", ".", "__filepath", ",", "self", ".", "access_type_int", ",", "self", ".", "__create_mode", ")", "if", "self", ".", "access_...
This is the only way to open a file resource.
[ "This", "is", "the", "only", "way", "to", "open", "a", "file", "resource", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L698-L709
train
This method opens a file resource.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFileObject.read
def read(self, size=None): """Read a length of bytes. Return empty on EOF. If 'size' is omitted, return whole file. """ if size is not None: return self.__sf.read(size) block_size = self.__class__.__block_size b = bytearray() received_bytes = 0 ...
python
def read(self, size=None): """Read a length of bytes. Return empty on EOF. If 'size' is omitted, return whole file. """ if size is not None: return self.__sf.read(size) block_size = self.__class__.__block_size b = bytearray() received_bytes = 0 ...
[ "def", "read", "(", "self", ",", "size", "=", "None", ")", ":", "if", "size", "is", "not", "None", ":", "return", "self", ".", "__sf", ".", "read", "(", "size", ")", "block_size", "=", "self", ".", "__class__", ".", "__block_size", "b", "=", "bytea...
Read a length of bytes. Return empty on EOF. If 'size' is omitted, return whole file.
[ "Read", "a", "length", "of", "bytes", ".", "Return", "empty", "on", "EOF", ".", "If", "size", "is", "omitted", "return", "whole", "file", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L886-L912
train
Read a length of bytes. Return empty on EOF.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFileObject.seek
def seek(self, offset, whence=SEEK_SET): """Reposition the file pointer.""" if whence == SEEK_SET: self.__sf.seek(offset) elif whence == SEEK_CUR: self.__sf.seek(self.tell() + offset) elif whence == SEEK_END: self.__sf.seek(self.__sf.filesize - offset...
python
def seek(self, offset, whence=SEEK_SET): """Reposition the file pointer.""" if whence == SEEK_SET: self.__sf.seek(offset) elif whence == SEEK_CUR: self.__sf.seek(self.tell() + offset) elif whence == SEEK_END: self.__sf.seek(self.__sf.filesize - offset...
[ "def", "seek", "(", "self", ",", "offset", ",", "whence", "=", "SEEK_SET", ")", ":", "if", "whence", "==", "SEEK_SET", ":", "self", ".", "__sf", ".", "seek", "(", "offset", ")", "elif", "whence", "==", "SEEK_CUR", ":", "self", ".", "__sf", ".", "se...
Reposition the file pointer.
[ "Reposition", "the", "file", "pointer", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L919-L927
train
Reposition the file pointer.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFileObject.readline
def readline(self, size=None): """Read a single line of text with EOF.""" # TODO: Add support for Unicode. (line, nl) = self.__buffer.read_until_nl(self.__retrieve_data) if self.__sf.access_type_has_universal_nl and nl is not None: self.__newlines[nl] = True return line
python
def readline(self, size=None): """Read a single line of text with EOF.""" # TODO: Add support for Unicode. (line, nl) = self.__buffer.read_until_nl(self.__retrieve_data) if self.__sf.access_type_has_universal_nl and nl is not None: self.__newlines[nl] = True return line
[ "def", "readline", "(", "self", ",", "size", "=", "None", ")", ":", "# TODO: Add support for Unicode.", "(", "line", ",", "nl", ")", "=", "self", ".", "__buffer", ".", "read_until_nl", "(", "self", ".", "__retrieve_data", ")", "if", "self", ".", "__sf", ...
Read a single line of text with EOF.
[ "Read", "a", "single", "line", "of", "text", "with", "EOF", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L960-L969
train
Read a single line of text with EOF.
dsoprea/PySecure
pysecure/adapters/sftpa.py
SftpFileObject.__retrieve_data
def __retrieve_data(self): """Read more data from the file.""" if self.__eof is True: return b'' logging.debug("Reading another block.") block = self.read(self.__block_size) if block == b'': self.__log.debug("We've encountered the EOF.") ...
python
def __retrieve_data(self): """Read more data from the file.""" if self.__eof is True: return b'' logging.debug("Reading another block.") block = self.read(self.__block_size) if block == b'': self.__log.debug("We've encountered the EOF.") ...
[ "def", "__retrieve_data", "(", "self", ")", ":", "if", "self", ".", "__eof", "is", "True", ":", "return", "b''", "logging", ".", "debug", "(", "\"Reading another block.\"", ")", "block", "=", "self", ".", "read", "(", "self", ".", "__block_size", ")", "i...
Read more data from the file.
[ "Read", "more", "data", "from", "the", "file", "." ]
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/adapters/sftpa.py#L971-L983
train
Read more data from the file.
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.clean_boundary_shapefile
def clean_boundary_shapefile(shapefile_path): """ Cleans the boundary shapefile to that there is only one main polygon. :param shapefile_path: :return: """ wfg = gpd.read_file(shapefile_path) first_shape = wfg.iloc[0].geometry if hasattr(first_shape, 'geo...
python
def clean_boundary_shapefile(shapefile_path): """ Cleans the boundary shapefile to that there is only one main polygon. :param shapefile_path: :return: """ wfg = gpd.read_file(shapefile_path) first_shape = wfg.iloc[0].geometry if hasattr(first_shape, 'geo...
[ "def", "clean_boundary_shapefile", "(", "shapefile_path", ")", ":", "wfg", "=", "gpd", ".", "read_file", "(", "shapefile_path", ")", "first_shape", "=", "wfg", ".", "iloc", "[", "0", "]", ".", "geometry", "if", "hasattr", "(", "first_shape", ",", "'geoms'", ...
Cleans the boundary shapefile to that there is only one main polygon. :param shapefile_path: :return:
[ "Cleans", "the", "boundary", "shapefile", "to", "that", "there", "is", "only", "one", "main", "polygon", ".", ":", "param", "shapefile_path", ":", ":", "return", ":" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L160-L194
train
Cleans the boundary shapefile to that there is only one main polygon.
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.set_mask_from_shapefile
def set_mask_from_shapefile(self, shapefile_path, cell_size): """ Adds a mask from a shapefile """ # make sure paths are absolute as the working directory changes shapefile_path = os.path.abspath(shapefile_path) # ADD MASK with tmp_chdir(self.project_directory): ...
python
def set_mask_from_shapefile(self, shapefile_path, cell_size): """ Adds a mask from a shapefile """ # make sure paths are absolute as the working directory changes shapefile_path = os.path.abspath(shapefile_path) # ADD MASK with tmp_chdir(self.project_directory): ...
[ "def", "set_mask_from_shapefile", "(", "self", ",", "shapefile_path", ",", "cell_size", ")", ":", "# make sure paths are absolute as the working directory changes", "shapefile_path", "=", "os", ".", "path", ".", "abspath", "(", "shapefile_path", ")", "# ADD MASK", "with",...
Adds a mask from a shapefile
[ "Adds", "a", "mask", "from", "a", "shapefile" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L196-L211
train
Adds a mask from a shapefile
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.set_elevation
def set_elevation(self, elevation_grid_path, mask_shapefile): """ Adds elevation file to project """ # ADD ELEVATION FILE ele_file = ElevationGridFile(project_file=self.project_manager, session=self.db_session) ele_file.generateFromRas...
python
def set_elevation(self, elevation_grid_path, mask_shapefile): """ Adds elevation file to project """ # ADD ELEVATION FILE ele_file = ElevationGridFile(project_file=self.project_manager, session=self.db_session) ele_file.generateFromRas...
[ "def", "set_elevation", "(", "self", ",", "elevation_grid_path", ",", "mask_shapefile", ")", ":", "# ADD ELEVATION FILE", "ele_file", "=", "ElevationGridFile", "(", "project_file", "=", "self", ".", "project_manager", ",", "session", "=", "self", ".", "db_session", ...
Adds elevation file to project
[ "Adds", "elevation", "file", "to", "project" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L213-L222
train
Adds elevation file to project
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.set_outlet
def set_outlet(self, latitude, longitude, outslope): """ Adds outlet point to project """ self.project_manager.setOutlet(latitude=latitude, longitude=longitude, outslope=outslope)
python
def set_outlet(self, latitude, longitude, outslope): """ Adds outlet point to project """ self.project_manager.setOutlet(latitude=latitude, longitude=longitude, outslope=outslope)
[ "def", "set_outlet", "(", "self", ",", "latitude", ",", "longitude", ",", "outslope", ")", ":", "self", ".", "project_manager", ".", "setOutlet", "(", "latitude", "=", "latitude", ",", "longitude", "=", "longitude", ",", "outslope", "=", "outslope", ")" ]
Adds outlet point to project
[ "Adds", "outlet", "point", "to", "project" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L224-L229
train
Adds outlet point to project
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.set_roughness
def set_roughness(self, roughness=None, land_use_grid=None, land_use_grid_id=None, land_use_to_roughness_table=None): """ ADD ROUGHNESS FROM LAND COVER See: http://www.gsshawiki.com/Project_File:Overland_Flow...
python
def set_roughness(self, roughness=None, land_use_grid=None, land_use_grid_id=None, land_use_to_roughness_table=None): """ ADD ROUGHNESS FROM LAND COVER See: http://www.gsshawiki.com/Project_File:Overland_Flow...
[ "def", "set_roughness", "(", "self", ",", "roughness", "=", "None", ",", "land_use_grid", "=", "None", ",", "land_use_grid_id", "=", "None", ",", "land_use_to_roughness_table", "=", "None", ")", ":", "if", "roughness", "is", "not", "None", ":", "self", ".", ...
ADD ROUGHNESS FROM LAND COVER See: http://www.gsshawiki.com/Project_File:Overland_Flow_%E2%80%93_Required
[ "ADD", "ROUGHNESS", "FROM", "LAND", "COVER", "See", ":", "http", ":", "//", "www", ".", "gsshawiki", ".", "com", "/", "Project_File", ":", "Overland_Flow_%E2%80%93_Required" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L231-L257
train
Set roughness of a map from a land use grid.
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.set_event
def set_event(self, simulation_start=None, simulation_duration=None, simulation_end=None, rain_intensity=2, rain_duration=timedelta(seconds=30*60), event_type='EVENT', ): """ Init...
python
def set_event(self, simulation_start=None, simulation_duration=None, simulation_end=None, rain_intensity=2, rain_duration=timedelta(seconds=30*60), event_type='EVENT', ): """ Init...
[ "def", "set_event", "(", "self", ",", "simulation_start", "=", "None", ",", "simulation_duration", "=", "None", ",", "simulation_end", "=", "None", ",", "rain_intensity", "=", "2", ",", "rain_duration", "=", "timedelta", "(", "seconds", "=", "30", "*", "60",...
Initializes event for GSSHA model
[ "Initializes", "event", "for", "GSSHA", "model" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L259-L287
train
Sets the event for the current model.
CI-WATER/gsshapy
gsshapy/modeling/model.py
GSSHAModel.write
def write(self): """ Write project to directory """ # write data self.project_manager.writeInput(session=self.db_session, directory=self.project_directory, name=self.project_manager.name)
python
def write(self): """ Write project to directory """ # write data self.project_manager.writeInput(session=self.db_session, directory=self.project_directory, name=self.project_manager.name)
[ "def", "write", "(", "self", ")", ":", "# write data", "self", ".", "project_manager", ".", "writeInput", "(", "session", "=", "self", ".", "db_session", ",", "directory", "=", "self", ".", "project_directory", ",", "name", "=", "self", ".", "project_manager...
Write project to directory
[ "Write", "project", "to", "directory" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/model.py#L289-L296
train
Write project to directory
dsoprea/PySecure
pysecure/sftp_mirror.py
SftpMirror.mirror
def mirror(self, handler, path_from, path_to, log_files=False): """Recursively mirror the contents of "path_from" into "path_to". "handler" should be self.mirror_to_local_no_recursion or self.mirror_to_remote_no_recursion to represent which way the files are moving. """ ...
python
def mirror(self, handler, path_from, path_to, log_files=False): """Recursively mirror the contents of "path_from" into "path_to". "handler" should be self.mirror_to_local_no_recursion or self.mirror_to_remote_no_recursion to represent which way the files are moving. """ ...
[ "def", "mirror", "(", "self", ",", "handler", ",", "path_from", ",", "path_to", ",", "log_files", "=", "False", ")", ":", "q", "=", "deque", "(", "[", "''", "]", ")", "while", "q", ":", "path", "=", "q", ".", "popleft", "(", ")", "full_from", "="...
Recursively mirror the contents of "path_from" into "path_to". "handler" should be self.mirror_to_local_no_recursion or self.mirror_to_remote_no_recursion to represent which way the files are moving.
[ "Recursively", "mirror", "the", "contents", "of", "path_from", "into", "path_to", ".", "handler", "should", "be", "self", ".", "mirror_to_local_no_recursion", "or", "self", ".", "mirror_to_remote_no_recursion", "to", "represent", "which", "way", "the", "files", "are...
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/sftp_mirror.py#L26-L42
train
Recursively mirror the contents of path_from into path_to.
dsoprea/PySecure
pysecure/sftp_mirror.py
SftpMirror.mirror_to_local_no_recursion
def mirror_to_local_no_recursion(self, path_from, path_to, log_files=False): """Mirror a directory without descending into directories. Return a list of subdirectory names (do not include full path). We will unlink existing files without determining if the...
python
def mirror_to_local_no_recursion(self, path_from, path_to, log_files=False): """Mirror a directory without descending into directories. Return a list of subdirectory names (do not include full path). We will unlink existing files without determining if the...
[ "def", "mirror_to_local_no_recursion", "(", "self", ",", "path_from", ",", "path_to", ",", "log_files", "=", "False", ")", ":", "self", ".", "__log", ".", "debug", "(", "\"Ensuring local target directory exists: %s\"", "%", "(", "path_to", ")", ")", "try", ":", ...
Mirror a directory without descending into directories. Return a list of subdirectory names (do not include full path). We will unlink existing files without determining if they're just going to be rewritten and then truncating them because it is our belief, based on what little we c...
[ "Mirror", "a", "directory", "without", "descending", "into", "directories", ".", "Return", "a", "list", "of", "subdirectory", "names", "(", "do", "not", "include", "full", "path", ")", ".", "We", "will", "unlink", "existing", "files", "without", "determining",...
ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0
https://github.com/dsoprea/PySecure/blob/ff7e01a0a77e79564cb00b6e38b4e6f9f88674f0/pysecure/sftp_mirror.py#L253-L282
train
Mirror a directory without descending into directories. Return a list of subdirectory names that are not included in the local target.
CI-WATER/gsshapy
gsshapy/orm/lnd.py
LinkNodeDatasetFile.linkToChannelInputFile
def linkToChannelInputFile(self, session, channelInputFile, force=False): """ Create database relationships between the link node dataset and the channel input file. The link node dataset only stores references to the links and nodes--not the geometry. The link and node geometries are s...
python
def linkToChannelInputFile(self, session, channelInputFile, force=False): """ Create database relationships between the link node dataset and the channel input file. The link node dataset only stores references to the links and nodes--not the geometry. The link and node geometries are s...
[ "def", "linkToChannelInputFile", "(", "self", ",", "session", ",", "channelInputFile", ",", "force", "=", "False", ")", ":", "# Only perform operation if the channel input file has not been assigned or the force parameter is true", "if", "self", ".", "channelInputFile", "is", ...
Create database relationships between the link node dataset and the channel input file. The link node dataset only stores references to the links and nodes--not the geometry. The link and node geometries are stored in the channel input file. The two files must be linked with database relationships to ...
[ "Create", "database", "relationships", "between", "the", "link", "node", "dataset", "and", "the", "channel", "input", "file", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/lnd.py#L76-L131
train
Link the link node dataset and the node dataset with the channel input file.
CI-WATER/gsshapy
gsshapy/orm/lnd.py
LinkNodeDatasetFile.getAsKmlAnimation
def getAsKmlAnimation(self, session, channelInputFile, path=None, documentName=None, styles={}): """ Generate a KML visualization of the the link node dataset file. Link node dataset files are time stamped link node value datasets. This will yield a value for each stream node at each ti...
python
def getAsKmlAnimation(self, session, channelInputFile, path=None, documentName=None, styles={}): """ Generate a KML visualization of the the link node dataset file. Link node dataset files are time stamped link node value datasets. This will yield a value for each stream node at each ti...
[ "def", "getAsKmlAnimation", "(", "self", ",", "session", ",", "channelInputFile", ",", "path", "=", "None", ",", "documentName", "=", "None", ",", "styles", "=", "{", "}", ")", ":", "# Constants", "DECMIAL_DEGREE_METER", "=", "0.00001", "OPTIMAL_Z_MAX", "=", ...
Generate a KML visualization of the the link node dataset file. Link node dataset files are time stamped link node value datasets. This will yield a value for each stream node at each time step that output is written. The resulting KML visualization will be an animation. The stream nodes are r...
[ "Generate", "a", "KML", "visualization", "of", "the", "the", "link", "node", "dataset", "file", "." ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/lnd.py#L133-L352
train
Returns a KML animation for the link node dataset file.
CI-WATER/gsshapy
gsshapy/orm/lnd.py
LinkNodeDatasetFile._read
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Link Node Dataset File Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and parse...
python
def _read(self, directory, filename, session, path, name, extension, spatial, spatialReferenceID, replaceParamFile): """ Link Node Dataset File Read from File Method """ # Set file extension property self.fileExtension = extension # Dictionary of keywords/cards and parse...
[ "def", "_read", "(", "self", ",", "directory", ",", "filename", ",", "session", ",", "path", ",", "name", ",", "extension", ",", "spatial", ",", "spatialReferenceID", ",", "replaceParamFile", ")", ":", "# Set file extension property", "self", ".", "fileExtension...
Link Node Dataset File Read from File Method
[ "Link", "Node", "Dataset", "File", "Read", "from", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/lnd.py#L356-L448
train
Method to read Link Node Dataset File Method to set properties of Link Node Dataset object
CI-WATER/gsshapy
gsshapy/orm/lnd.py
LinkNodeDatasetFile._write
def _write(self, session, openFile, replaceParamFile): """ Link Node Dataset File Write to File Method """ # Retrieve TimeStep objects timeSteps = self.timeSteps # Write Lines openFile.write('%s\n' % self.name) openFile.write('NUM_LINKS %s\n' % self.n...
python
def _write(self, session, openFile, replaceParamFile): """ Link Node Dataset File Write to File Method """ # Retrieve TimeStep objects timeSteps = self.timeSteps # Write Lines openFile.write('%s\n' % self.name) openFile.write('NUM_LINKS %s\n' % self.n...
[ "def", "_write", "(", "self", ",", "session", ",", "openFile", ",", "replaceParamFile", ")", ":", "# Retrieve TimeStep objects", "timeSteps", "=", "self", ".", "timeSteps", "# Write Lines", "openFile", ".", "write", "(", "'%s\\n'", "%", "self", ".", "name", ")...
Link Node Dataset File Write to File Method
[ "Link", "Node", "Dataset", "File", "Write", "to", "File", "Method" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/orm/lnd.py#L452-L496
train
Method to write to File Method to Write to File Method to Write to File Method to Write to File Method
cs50/cli50
cli50/__main__.py
login
def login(container): """Log into container.""" columns, lines = shutil.get_terminal_size() # Temporary try: subprocess.check_call([ "docker", "exec", "--env", f"COLUMNS={str(columns)},LINES={str(lines)}", # Temporary "--env", f"LINES={str(lines)}", # Temporary...
python
def login(container): """Log into container.""" columns, lines = shutil.get_terminal_size() # Temporary try: subprocess.check_call([ "docker", "exec", "--env", f"COLUMNS={str(columns)},LINES={str(lines)}", # Temporary "--env", f"LINES={str(lines)}", # Temporary...
[ "def", "login", "(", "container", ")", ":", "columns", ",", "lines", "=", "shutil", ".", "get_terminal_size", "(", ")", "# Temporary", "try", ":", "subprocess", ".", "check_call", "(", "[", "\"docker\"", ",", "\"exec\"", ",", "\"--env\"", ",", "f\"COLUMNS={s...
Log into container.
[ "Log", "into", "container", "." ]
f712328200dd40c3e19e73893644cb61125ea66e
https://github.com/cs50/cli50/blob/f712328200dd40c3e19e73893644cb61125ea66e/cli50/__main__.py#L195-L210
train
Log into container.
CI-WATER/gsshapy
gsshapy/modeling/event.py
Event._update_card
def _update_card(self, card_name, new_value, add_quotes=False): """ Adds/updates card for gssha project file """ self.project_manager.setCard(card_name, new_value, add_quotes)
python
def _update_card(self, card_name, new_value, add_quotes=False): """ Adds/updates card for gssha project file """ self.project_manager.setCard(card_name, new_value, add_quotes)
[ "def", "_update_card", "(", "self", ",", "card_name", ",", "new_value", ",", "add_quotes", "=", "False", ")", ":", "self", ".", "project_manager", ".", "setCard", "(", "card_name", ",", "new_value", ",", "add_quotes", ")" ]
Adds/updates card for gssha project file
[ "Adds", "/", "updates", "card", "for", "gssha", "project", "file" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L135-L139
train
Updates the value of a card in the project file.
CI-WATER/gsshapy
gsshapy/modeling/event.py
Event._update_simulation_start_cards
def _update_simulation_start_cards(self): """ Update GSSHA cards for simulation start """ if self.simulation_start is not None: self._update_card("START_DATE", self.simulation_start.strftime("%Y %m %d")) self._update_card("START_TIME", self.simulation_start.strfti...
python
def _update_simulation_start_cards(self): """ Update GSSHA cards for simulation start """ if self.simulation_start is not None: self._update_card("START_DATE", self.simulation_start.strftime("%Y %m %d")) self._update_card("START_TIME", self.simulation_start.strfti...
[ "def", "_update_simulation_start_cards", "(", "self", ")", ":", "if", "self", ".", "simulation_start", "is", "not", "None", ":", "self", ".", "_update_card", "(", "\"START_DATE\"", ",", "self", ".", "simulation_start", ".", "strftime", "(", "\"%Y %m %d\"", ")", ...
Update GSSHA cards for simulation start
[ "Update", "GSSHA", "cards", "for", "simulation", "start" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L157-L163
train
Update GSSHA cards for simulation start
CI-WATER/gsshapy
gsshapy/modeling/event.py
Event._update_simulation_end_from_lsm
def _update_simulation_end_from_lsm(self): """ Update simulation end time from LSM """ te = self.l2g.xd.lsm.datetime[-1] simulation_end = te.replace(tzinfo=utc) \ .astimezone(tz=self.tz) \ .replace(tzinfo=None) if sel...
python
def _update_simulation_end_from_lsm(self): """ Update simulation end time from LSM """ te = self.l2g.xd.lsm.datetime[-1] simulation_end = te.replace(tzinfo=utc) \ .astimezone(tz=self.tz) \ .replace(tzinfo=None) if sel...
[ "def", "_update_simulation_end_from_lsm", "(", "self", ")", ":", "te", "=", "self", ".", "l2g", ".", "xd", ".", "lsm", ".", "datetime", "[", "-", "1", "]", "simulation_end", "=", "te", ".", "replace", "(", "tzinfo", "=", "utc", ")", ".", "astimezone", ...
Update simulation end time from LSM
[ "Update", "simulation", "end", "time", "from", "LSM" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L165-L180
train
Update simulation end time from LSM record.
CI-WATER/gsshapy
gsshapy/modeling/event.py
Event.add_precip_file
def add_precip_file(self, precip_file_path, interpolation_type=None): """ Adds a precip file to project with interpolation_type """ # precip file read in self._update_card('PRECIP_FILE', precip_file_path, True) if interpolation_type is None: # check if precip...
python
def add_precip_file(self, precip_file_path, interpolation_type=None): """ Adds a precip file to project with interpolation_type """ # precip file read in self._update_card('PRECIP_FILE', precip_file_path, True) if interpolation_type is None: # check if precip...
[ "def", "add_precip_file", "(", "self", ",", "precip_file_path", ",", "interpolation_type", "=", "None", ")", ":", "# precip file read in", "self", ".", "_update_card", "(", "'PRECIP_FILE'", ",", "precip_file_path", ",", "True", ")", "if", "interpolation_type", "is",...
Adds a precip file to project with interpolation_type
[ "Adds", "a", "precip", "file", "to", "project", "with", "interpolation_type" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L197-L220
train
Adds a precip file to the project with interpolation_type
CI-WATER/gsshapy
gsshapy/modeling/event.py
Event.prepare_gag_lsm
def prepare_gag_lsm(self, lsm_precip_data_var, lsm_precip_type, interpolation_type=None): """ Prepares Gage output for GSSHA simulation Parameters: lsm_precip_data_var(list or str): String of name for precipitation variable name or list of precip variable names. See: :func:`~gsshap...
python
def prepare_gag_lsm(self, lsm_precip_data_var, lsm_precip_type, interpolation_type=None): """ Prepares Gage output for GSSHA simulation Parameters: lsm_precip_data_var(list or str): String of name for precipitation variable name or list of precip variable names. See: :func:`~gsshap...
[ "def", "prepare_gag_lsm", "(", "self", ",", "lsm_precip_data_var", ",", "lsm_precip_type", ",", "interpolation_type", "=", "None", ")", ":", "if", "self", ".", "l2g", "is", "None", ":", "raise", "ValueError", "(", "\"LSM converter not loaded ...\"", ")", "# remove...
Prepares Gage output for GSSHA simulation Parameters: lsm_precip_data_var(list or str): String of name for precipitation variable name or list of precip variable names. See: :func:`~gsshapy.grid.GRIDtoGSSHA.lsm_precip_to_gssha_precip_gage`. lsm_precip_type(str): Type of precipitation. ...
[ "Prepares", "Gage", "output", "for", "GSSHA", "simulation" ]
00fd4af0fd65f1614d75a52fe950a04fb0867f4c
https://github.com/CI-WATER/gsshapy/blob/00fd4af0fd65f1614d75a52fe950a04fb0867f4c/gsshapy/modeling/event.py#L222-L253
train
Prepares GSSHA simulation for the given LSM precipitation variable.