id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
48,100
ungarj/s2reader
s2reader/s2reader.py
SentinelDataSet.footprint
def footprint(self): """Return product footprint.""" product_footprint = self._product_metadata.iter("Product_Footprint") # I don't know why two "Product_Footprint" items are found. for element in product_footprint: global_footprint = None for global_footprint in ...
python
def footprint(self): """Return product footprint.""" product_footprint = self._product_metadata.iter("Product_Footprint") # I don't know why two "Product_Footprint" items are found. for element in product_footprint: global_footprint = None for global_footprint in ...
[ "def", "footprint", "(", "self", ")", ":", "product_footprint", "=", "self", ".", "_product_metadata", ".", "iter", "(", "\"Product_Footprint\"", ")", "# I don't know why two \"Product_Footprint\" items are found.", "for", "element", "in", "product_footprint", ":", "globa...
Return product footprint.
[ "Return", "product", "footprint", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L173-L181
48,101
ungarj/s2reader
s2reader/s2reader.py
SentinelDataSet.granules
def granules(self): """Return list of SentinelGranule objects.""" for element in self._product_metadata.iter("Product_Info"): product_organisation = element.find("Product_Organisation") if self.product_format == 'SAFE': return [ SentinelGranule(_id.find("G...
python
def granules(self): """Return list of SentinelGranule objects.""" for element in self._product_metadata.iter("Product_Info"): product_organisation = element.find("Product_Organisation") if self.product_format == 'SAFE': return [ SentinelGranule(_id.find("G...
[ "def", "granules", "(", "self", ")", ":", "for", "element", "in", "self", ".", "_product_metadata", ".", "iter", "(", "\"Product_Info\"", ")", ":", "product_organisation", "=", "element", ".", "find", "(", "\"Product_Organisation\"", ")", "if", "self", ".", ...
Return list of SentinelGranule objects.
[ "Return", "list", "of", "SentinelGranule", "objects", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L184-L203
48,102
ungarj/s2reader
s2reader/s2reader.py
SentinelDataSet.granule_paths
def granule_paths(self, band_id): """Return the path of all granules of a given band.""" band_id = str(band_id).zfill(2) try: assert isinstance(band_id, str) assert band_id in BAND_IDS except AssertionError: raise AttributeError( "band ...
python
def granule_paths(self, band_id): """Return the path of all granules of a given band.""" band_id = str(band_id).zfill(2) try: assert isinstance(band_id, str) assert band_id in BAND_IDS except AssertionError: raise AttributeError( "band ...
[ "def", "granule_paths", "(", "self", ",", "band_id", ")", ":", "band_id", "=", "str", "(", "band_id", ")", ".", "zfill", "(", "2", ")", "try", ":", "assert", "isinstance", "(", "band_id", ",", "str", ")", "assert", "band_id", "in", "BAND_IDS", "except"...
Return the path of all granules of a given band.
[ "Return", "the", "path", "of", "all", "granules", "of", "a", "given", "band", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L205-L218
48,103
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.metadata_path
def metadata_path(self): """Determine the metadata path.""" xml_name = _granule_identifier_to_xml_name(self.granule_identifier) metadata_path = os.path.join(self.granule_path, xml_name) try: assert os.path.isfile(metadata_path) or \ metadata_path in self.datas...
python
def metadata_path(self): """Determine the metadata path.""" xml_name = _granule_identifier_to_xml_name(self.granule_identifier) metadata_path = os.path.join(self.granule_path, xml_name) try: assert os.path.isfile(metadata_path) or \ metadata_path in self.datas...
[ "def", "metadata_path", "(", "self", ")", ":", "xml_name", "=", "_granule_identifier_to_xml_name", "(", "self", ".", "granule_identifier", ")", "metadata_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "granule_path", ",", "xml_name", ")", "try",...
Determine the metadata path.
[ "Determine", "the", "metadata", "path", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L273-L283
48,104
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.tci_path
def tci_path(self): """Return the path to the granules TrueColorImage.""" tci_paths = [ path for path in self.dataset._product_metadata.xpath( ".//Granule[@granuleIdentifier='%s']/IMAGE_FILE/text()" % self.granule_identifier ) if path.endswith('TCI...
python
def tci_path(self): """Return the path to the granules TrueColorImage.""" tci_paths = [ path for path in self.dataset._product_metadata.xpath( ".//Granule[@granuleIdentifier='%s']/IMAGE_FILE/text()" % self.granule_identifier ) if path.endswith('TCI...
[ "def", "tci_path", "(", "self", ")", ":", "tci_paths", "=", "[", "path", "for", "path", "in", "self", ".", "dataset", ".", "_product_metadata", ".", "xpath", "(", "\".//Granule[@granuleIdentifier='%s']/IMAGE_FILE/text()\"", "%", "self", ".", "granule_identifier", ...
Return the path to the granules TrueColorImage.
[ "Return", "the", "path", "to", "the", "granules", "TrueColorImage", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L291-L307
48,105
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.cloud_percent
def cloud_percent(self): """Return percentage of cloud coverage.""" image_content_qi = self._metadata.findtext( ( """n1:Quality_Indicators_Info/Image_Content_QI/""" """CLOUDY_PIXEL_PERCENTAGE""" ), namespaces=self._nsmap) return...
python
def cloud_percent(self): """Return percentage of cloud coverage.""" image_content_qi = self._metadata.findtext( ( """n1:Quality_Indicators_Info/Image_Content_QI/""" """CLOUDY_PIXEL_PERCENTAGE""" ), namespaces=self._nsmap) return...
[ "def", "cloud_percent", "(", "self", ")", ":", "image_content_qi", "=", "self", ".", "_metadata", ".", "findtext", "(", "(", "\"\"\"n1:Quality_Indicators_Info/Image_Content_QI/\"\"\"", "\"\"\"CLOUDY_PIXEL_PERCENTAGE\"\"\"", ")", ",", "namespaces", "=", "self", ".", "_ns...
Return percentage of cloud coverage.
[ "Return", "percentage", "of", "cloud", "coverage", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L310-L318
48,106
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.footprint
def footprint(self): """Find and return footprint as Shapely Polygon.""" # Check whether product or granule footprint needs to be calculated. tile_geocoding = self._metadata.iter("Tile_Geocoding").next() resolution = 10 searchstring = ".//*[@resolution='%s']" % resolution ...
python
def footprint(self): """Find and return footprint as Shapely Polygon.""" # Check whether product or granule footprint needs to be calculated. tile_geocoding = self._metadata.iter("Tile_Geocoding").next() resolution = 10 searchstring = ".//*[@resolution='%s']" % resolution ...
[ "def", "footprint", "(", "self", ")", ":", "# Check whether product or granule footprint needs to be calculated.", "tile_geocoding", "=", "self", ".", "_metadata", ".", "iter", "(", "\"Tile_Geocoding\"", ")", ".", "next", "(", ")", "resolution", "=", "10", "searchstri...
Find and return footprint as Shapely Polygon.
[ "Find", "and", "return", "footprint", "as", "Shapely", "Polygon", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L321-L339
48,107
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.cloudmask
def cloudmask(self): """Return cloudmask as a shapely geometry.""" polys = list(self._get_mask(mask_type="MSK_CLOUDS")) return MultiPolygon([ poly["geometry"] for poly in polys if poly["attributes"]["maskType"] == "OPAQUE" ]).buffer(0)
python
def cloudmask(self): """Return cloudmask as a shapely geometry.""" polys = list(self._get_mask(mask_type="MSK_CLOUDS")) return MultiPolygon([ poly["geometry"] for poly in polys if poly["attributes"]["maskType"] == "OPAQUE" ]).buffer(0)
[ "def", "cloudmask", "(", "self", ")", ":", "polys", "=", "list", "(", "self", ".", "_get_mask", "(", "mask_type", "=", "\"MSK_CLOUDS\"", ")", ")", "return", "MultiPolygon", "(", "[", "poly", "[", "\"geometry\"", "]", "for", "poly", "in", "polys", "if", ...
Return cloudmask as a shapely geometry.
[ "Return", "cloudmask", "as", "a", "shapely", "geometry", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L342-L349
48,108
ungarj/s2reader
s2reader/s2reader.py
SentinelGranule.band_path
def band_path(self, band_id, for_gdal=False, absolute=False): """Return paths of given band's jp2 files for all granules.""" band_id = str(band_id).zfill(2) if not isinstance(band_id, str) or band_id not in BAND_IDS: raise ValueError("band ID not valid: %s" % band_id) if self...
python
def band_path(self, band_id, for_gdal=False, absolute=False): """Return paths of given band's jp2 files for all granules.""" band_id = str(band_id).zfill(2) if not isinstance(band_id, str) or band_id not in BAND_IDS: raise ValueError("band ID not valid: %s" % band_id) if self...
[ "def", "band_path", "(", "self", ",", "band_id", ",", "for_gdal", "=", "False", ",", "absolute", "=", "False", ")", ":", "band_id", "=", "str", "(", "band_id", ")", ".", "zfill", "(", "2", ")", "if", "not", "isinstance", "(", "band_id", ",", "str", ...
Return paths of given band's jp2 files for all granules.
[ "Return", "paths", "of", "given", "band", "s", "jp2", "files", "for", "all", "granules", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/s2reader.py#L357-L428
48,109
buckhx/QuadKey
quadkey/tile_system.py
TileSystem.geo_to_pixel
def geo_to_pixel(geo, level): """Transform from geo coordinates to pixel coordinates""" lat, lon = float(geo[0]), float(geo[1]) lat = TileSystem.clip(lat, TileSystem.LATITUDE_RANGE) lon = TileSystem.clip(lon, TileSystem.LONGITUDE_RANGE) x = (lon + 180) / 360 sin_lat = sin...
python
def geo_to_pixel(geo, level): """Transform from geo coordinates to pixel coordinates""" lat, lon = float(geo[0]), float(geo[1]) lat = TileSystem.clip(lat, TileSystem.LATITUDE_RANGE) lon = TileSystem.clip(lon, TileSystem.LONGITUDE_RANGE) x = (lon + 180) / 360 sin_lat = sin...
[ "def", "geo_to_pixel", "(", "geo", ",", "level", ")", ":", "lat", ",", "lon", "=", "float", "(", "geo", "[", "0", "]", ")", ",", "float", "(", "geo", "[", "1", "]", ")", "lat", "=", "TileSystem", ".", "clip", "(", "lat", ",", "TileSystem", ".",...
Transform from geo coordinates to pixel coordinates
[ "Transform", "from", "geo", "coordinates", "to", "pixel", "coordinates" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/tile_system.py#L55-L69
48,110
buckhx/QuadKey
quadkey/tile_system.py
TileSystem.pixel_to_geo
def pixel_to_geo(pixel, level): """Transform from pixel to geo coordinates""" pixel_x = pixel[0] pixel_y = pixel[1] map_size = float(TileSystem.map_size(level)) x = (TileSystem.clip(pixel_x, (0, map_size - 1)) / map_size) - 0.5 y = 0.5 - (TileSystem.clip(pixel_y, (0, map_...
python
def pixel_to_geo(pixel, level): """Transform from pixel to geo coordinates""" pixel_x = pixel[0] pixel_y = pixel[1] map_size = float(TileSystem.map_size(level)) x = (TileSystem.clip(pixel_x, (0, map_size - 1)) / map_size) - 0.5 y = 0.5 - (TileSystem.clip(pixel_y, (0, map_...
[ "def", "pixel_to_geo", "(", "pixel", ",", "level", ")", ":", "pixel_x", "=", "pixel", "[", "0", "]", "pixel_y", "=", "pixel", "[", "1", "]", "map_size", "=", "float", "(", "TileSystem", ".", "map_size", "(", "level", ")", ")", "x", "=", "(", "TileS...
Transform from pixel to geo coordinates
[ "Transform", "from", "pixel", "to", "geo", "coordinates" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/tile_system.py#L73-L82
48,111
buckhx/QuadKey
quadkey/tile_system.py
TileSystem.tile_to_pixel
def tile_to_pixel(tile, centered=False): """Transform tile to pixel coordinates""" pixel = [tile[0] * 256, tile[1] * 256] if centered: # should clip on max map size pixel = [pix + 128 for pix in pixel] return pixel[0], pixel[1]
python
def tile_to_pixel(tile, centered=False): """Transform tile to pixel coordinates""" pixel = [tile[0] * 256, tile[1] * 256] if centered: # should clip on max map size pixel = [pix + 128 for pix in pixel] return pixel[0], pixel[1]
[ "def", "tile_to_pixel", "(", "tile", ",", "centered", "=", "False", ")", ":", "pixel", "=", "[", "tile", "[", "0", "]", "*", "256", ",", "tile", "[", "1", "]", "*", "256", "]", "if", "centered", ":", "# should clip on max map size", "pixel", "=", "["...
Transform tile to pixel coordinates
[ "Transform", "tile", "to", "pixel", "coordinates" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/tile_system.py#L90-L96
48,112
buckhx/QuadKey
quadkey/tile_system.py
TileSystem.tile_to_quadkey
def tile_to_quadkey(tile, level): """Transform tile coordinates to a quadkey""" tile_x = tile[0] tile_y = tile[1] quadkey = "" for i in xrange(level): bit = level - i digit = ord('0') mask = 1 << (bit - 1) # if (bit - 1) > 0 else 1 >> (bit - 1...
python
def tile_to_quadkey(tile, level): """Transform tile coordinates to a quadkey""" tile_x = tile[0] tile_y = tile[1] quadkey = "" for i in xrange(level): bit = level - i digit = ord('0') mask = 1 << (bit - 1) # if (bit - 1) > 0 else 1 >> (bit - 1...
[ "def", "tile_to_quadkey", "(", "tile", ",", "level", ")", ":", "tile_x", "=", "tile", "[", "0", "]", "tile_y", "=", "tile", "[", "1", "]", "quadkey", "=", "\"\"", "for", "i", "in", "xrange", "(", "level", ")", ":", "bit", "=", "level", "-", "i", ...
Transform tile coordinates to a quadkey
[ "Transform", "tile", "coordinates", "to", "a", "quadkey" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/tile_system.py#L100-L114
48,113
buckhx/QuadKey
quadkey/tile_system.py
TileSystem.quadkey_to_tile
def quadkey_to_tile(quadkey): """Transform quadkey to tile coordinates""" tile_x, tile_y = (0, 0) level = len(quadkey) for i in xrange(level): bit = level - i mask = 1 << (bit - 1) if quadkey[level - bit] == '1': tile_x |= mask ...
python
def quadkey_to_tile(quadkey): """Transform quadkey to tile coordinates""" tile_x, tile_y = (0, 0) level = len(quadkey) for i in xrange(level): bit = level - i mask = 1 << (bit - 1) if quadkey[level - bit] == '1': tile_x |= mask ...
[ "def", "quadkey_to_tile", "(", "quadkey", ")", ":", "tile_x", ",", "tile_y", "=", "(", "0", ",", "0", ")", "level", "=", "len", "(", "quadkey", ")", "for", "i", "in", "xrange", "(", "level", ")", ":", "bit", "=", "level", "-", "i", "mask", "=", ...
Transform quadkey to tile coordinates
[ "Transform", "quadkey", "to", "tile", "coordinates" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/tile_system.py#L117-L131
48,114
hanguokai/youku
youku/youku_oauth.py
YoukuOauth.authorize_url
def authorize_url(self, state=''): """ return user authorize url """ url = 'https://openapi.youku.com/v2/oauth2/authorize?' params = { 'client_id': self.client_id, 'response_type': 'code', 'state': state, 'redirect_uri': self.redirect_uri ...
python
def authorize_url(self, state=''): """ return user authorize url """ url = 'https://openapi.youku.com/v2/oauth2/authorize?' params = { 'client_id': self.client_id, 'response_type': 'code', 'state': state, 'redirect_uri': self.redirect_uri ...
[ "def", "authorize_url", "(", "self", ",", "state", "=", "''", ")", ":", "url", "=", "'https://openapi.youku.com/v2/oauth2/authorize?'", "params", "=", "{", "'client_id'", ":", "self", ".", "client_id", ",", "'response_type'", ":", "'code'", ",", "'state'", ":", ...
return user authorize url
[ "return", "user", "authorize", "url" ]
b2df060c7dccfad990bcfa289fff68bb77d1e69b
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_oauth.py#L28-L38
48,115
hanguokai/youku
youku/util.py
remove_none_value
def remove_none_value(data): """remove item from dict if value is None. return new dict. """ return dict((k, v) for k, v in data.items() if v is not None)
python
def remove_none_value(data): """remove item from dict if value is None. return new dict. """ return dict((k, v) for k, v in data.items() if v is not None)
[ "def", "remove_none_value", "(", "data", ")", ":", "return", "dict", "(", "(", "k", ",", "v", ")", "for", "k", ",", "v", "in", "data", ".", "items", "(", ")", "if", "v", "is", "not", "None", ")" ]
remove item from dict if value is None. return new dict.
[ "remove", "item", "from", "dict", "if", "value", "is", "None", ".", "return", "new", "dict", "." ]
b2df060c7dccfad990bcfa289fff68bb77d1e69b
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/util.py#L50-L54
48,116
wiheto/fetchopenfmri
fetchopenfmri/fetch.py
get_dataset
def get_dataset(ds,dataDir,removecompressed=1): """ A function which attempts downloads and uncompresses the latest version of an openfmri.fmri dataset. PARAMETERS :ds: dataset number of the openfMRI.org dataset (integer) without zero padding. I.e. can just be 212 (doesn't need to be 000212). :da...
python
def get_dataset(ds,dataDir,removecompressed=1): """ A function which attempts downloads and uncompresses the latest version of an openfmri.fmri dataset. PARAMETERS :ds: dataset number of the openfMRI.org dataset (integer) without zero padding. I.e. can just be 212 (doesn't need to be 000212). :da...
[ "def", "get_dataset", "(", "ds", ",", "dataDir", ",", "removecompressed", "=", "1", ")", ":", "#Convert input ds to string incase it is put in via function", "ds", "=", "str", "(", "ds", ")", "#The final character of the dataset can be a letter", "lettersuffix", "=", "''"...
A function which attempts downloads and uncompresses the latest version of an openfmri.fmri dataset. PARAMETERS :ds: dataset number of the openfMRI.org dataset (integer) without zero padding. I.e. can just be 212 (doesn't need to be 000212). :dataDir: where to save the data. Will get saved in 'dataDir/ope...
[ "A", "function", "which", "attempts", "downloads", "and", "uncompresses", "the", "latest", "version", "of", "an", "openfmri", ".", "fmri", "dataset", "." ]
2539f24ad795a29496a29b3a4252cba86a5e45f0
https://github.com/wiheto/fetchopenfmri/blob/2539f24ad795a29496a29b3a4252cba86a5e45f0/fetchopenfmri/fetch.py#L40-L109
48,117
hanguokai/youku
youku/youku_upload.py
YoukuUpload.prepare_video_params
def prepare_video_params(self, title=None, tags='Others', description='', copyright_type='original', public_type='all', category=None, watch_password=None, latitude=None, longitude=None, shoot_time=None )...
python
def prepare_video_params(self, title=None, tags='Others', description='', copyright_type='original', public_type='all', category=None, watch_password=None, latitude=None, longitude=None, shoot_time=None )...
[ "def", "prepare_video_params", "(", "self", ",", "title", "=", "None", ",", "tags", "=", "'Others'", ",", "description", "=", "''", ",", "copyright_type", "=", "'original'", ",", "public_type", "=", "'all'", ",", "category", "=", "None", ",", "watch_password...
util method for create video params to upload. Only need to provide a minimum of two essential parameters: title and tags, other video params are optional. All params spec see: http://cloud.youku.com/docs?id=110#create . Args: title: string, 2-50 characters. tag...
[ "util", "method", "for", "create", "video", "params", "to", "upload", "." ]
b2df060c7dccfad990bcfa289fff68bb77d1e69b
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_upload.py#L59-L109
48,118
hanguokai/youku
youku/youku_upload.py
YoukuUpload._save_upload_state_to_file
def _save_upload_state_to_file(self): """if create and create_file has execute, save upload state to file for next resume upload if current upload process is interrupted. """ if os.access(self.file_dir, os.W_OK | os.R_OK | os.X_OK): save_file = self.file + '.upload' ...
python
def _save_upload_state_to_file(self): """if create and create_file has execute, save upload state to file for next resume upload if current upload process is interrupted. """ if os.access(self.file_dir, os.W_OK | os.R_OK | os.X_OK): save_file = self.file + '.upload' ...
[ "def", "_save_upload_state_to_file", "(", "self", ")", ":", "if", "os", ".", "access", "(", "self", ".", "file_dir", ",", "os", ".", "W_OK", "|", "os", ".", "R_OK", "|", "os", ".", "X_OK", ")", ":", "save_file", "=", "self", ".", "file", "+", "'.up...
if create and create_file has execute, save upload state to file for next resume upload if current upload process is interrupted.
[ "if", "create", "and", "create_file", "has", "execute", "save", "upload", "state", "to", "file", "for", "next", "resume", "upload", "if", "current", "upload", "process", "is", "interrupted", "." ]
b2df060c7dccfad990bcfa289fff68bb77d1e69b
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_upload.py#L138-L150
48,119
hanguokai/youku
youku/youku_upload.py
YoukuUpload.upload
def upload(self, params={}): """start uploading the file until upload is complete or error. This is the main method to used, If you do not care about state of process. Args: params: a dict object describe video info, eg title, tags, description, ...
python
def upload(self, params={}): """start uploading the file until upload is complete or error. This is the main method to used, If you do not care about state of process. Args: params: a dict object describe video info, eg title, tags, description, ...
[ "def", "upload", "(", "self", ",", "params", "=", "{", "}", ")", ":", "if", "self", ".", "upload_token", "is", "not", "None", ":", "# resume upload", "status", "=", "self", ".", "check", "(", ")", "if", "status", "[", "'status'", "]", "!=", "4", ":...
start uploading the file until upload is complete or error. This is the main method to used, If you do not care about state of process. Args: params: a dict object describe video info, eg title, tags, description, category. all video para...
[ "start", "uploading", "the", "file", "until", "upload", "is", "complete", "or", "error", ".", "This", "is", "the", "main", "method", "to", "used", "If", "you", "do", "not", "care", "about", "state", "of", "process", "." ]
b2df060c7dccfad990bcfa289fff68bb77d1e69b
https://github.com/hanguokai/youku/blob/b2df060c7dccfad990bcfa289fff68bb77d1e69b/youku/youku_upload.py#L291-L321
48,120
jbittel/django-ldap-sync
ldap_sync/sync.py
SyncLDAP.sync_users
def sync_users(self): """Synchronize LDAP users with local user model.""" if self.settings.USER_FILTER: user_attributes = self.settings.USER_ATTRIBUTES.keys() + self.settings.USER_EXTRA_ATTRIBUTES ldap_users = self.ldap.search(self.settings.USER_FILTER, user_attributes) ...
python
def sync_users(self): """Synchronize LDAP users with local user model.""" if self.settings.USER_FILTER: user_attributes = self.settings.USER_ATTRIBUTES.keys() + self.settings.USER_EXTRA_ATTRIBUTES ldap_users = self.ldap.search(self.settings.USER_FILTER, user_attributes) ...
[ "def", "sync_users", "(", "self", ")", ":", "if", "self", ".", "settings", ".", "USER_FILTER", ":", "user_attributes", "=", "self", ".", "settings", ".", "USER_ATTRIBUTES", ".", "keys", "(", ")", "+", "self", ".", "settings", ".", "USER_EXTRA_ATTRIBUTES", ...
Synchronize LDAP users with local user model.
[ "Synchronize", "LDAP", "users", "with", "local", "user", "model", "." ]
d9ad679b32c16cf77b9d025728868fc2e1af41cd
https://github.com/jbittel/django-ldap-sync/blob/d9ad679b32c16cf77b9d025728868fc2e1af41cd/ldap_sync/sync.py#L45-L51
48,121
ungarj/s2reader
s2reader/cli/transform.py
main
def main(args=sys.argv[1:]): """Generate EO O&M XML metadata.""" parser = argparse.ArgumentParser() parser.add_argument("filename", nargs=1) parser.add_argument("--granule-id", dest="granule_id", help=( "Optional. Specify a granule to export metadata from." ) ) parser...
python
def main(args=sys.argv[1:]): """Generate EO O&M XML metadata.""" parser = argparse.ArgumentParser() parser.add_argument("filename", nargs=1) parser.add_argument("--granule-id", dest="granule_id", help=( "Optional. Specify a granule to export metadata from." ) ) parser...
[ "def", "main", "(", "args", "=", "sys", ".", "argv", "[", "1", ":", "]", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", ")", "parser", ".", "add_argument", "(", "\"filename\"", ",", "nargs", "=", "1", ")", "parser", ".", "add_argume...
Generate EO O&M XML metadata.
[ "Generate", "EO", "O&M", "XML", "metadata", "." ]
376fd7ee1d15cce0849709c149d694663a7bc0ef
https://github.com/ungarj/s2reader/blob/376fd7ee1d15cce0849709c149d694663a7bc0ef/s2reader/cli/transform.py#L348-L415
48,122
buckhx/QuadKey
quadkey/__init__.py
QuadKey.is_ancestor
def is_ancestor(self, node): """ If node is ancestor of self Get the difference in level If not, None """ if self.level <= node.level or self.key[:len(node.key)] != node.key: return None return self.level - node.level
python
def is_ancestor(self, node): """ If node is ancestor of self Get the difference in level If not, None """ if self.level <= node.level or self.key[:len(node.key)] != node.key: return None return self.level - node.level
[ "def", "is_ancestor", "(", "self", ",", "node", ")", ":", "if", "self", ".", "level", "<=", "node", ".", "level", "or", "self", ".", "key", "[", ":", "len", "(", "node", ".", "key", ")", "]", "!=", "node", ".", "key", ":", "return", "None", "re...
If node is ancestor of self Get the difference in level If not, None
[ "If", "node", "is", "ancestor", "of", "self", "Get", "the", "difference", "in", "level", "If", "not", "None" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/__init__.py#L33-L41
48,123
buckhx/QuadKey
quadkey/__init__.py
QuadKey.xdifference
def xdifference(self, to): """ Generator Gives the difference of quadkeys between self and to Generator in case done on a low level Only works with quadkeys of same level """ x,y = 0,1 assert self.level == to.level self_tile = list(self.to_tile...
python
def xdifference(self, to): """ Generator Gives the difference of quadkeys between self and to Generator in case done on a low level Only works with quadkeys of same level """ x,y = 0,1 assert self.level == to.level self_tile = list(self.to_tile...
[ "def", "xdifference", "(", "self", ",", "to", ")", ":", "x", ",", "y", "=", "0", ",", "1", "assert", "self", ".", "level", "==", "to", ".", "level", "self_tile", "=", "list", "(", "self", ".", "to_tile", "(", ")", "[", "0", "]", ")", "to_tile",...
Generator Gives the difference of quadkeys between self and to Generator in case done on a low level Only works with quadkeys of same level
[ "Generator", "Gives", "the", "difference", "of", "quadkeys", "between", "self", "and", "to", "Generator", "in", "case", "done", "on", "a", "low", "level", "Only", "works", "with", "quadkeys", "of", "same", "level" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/__init__.py#L58-L78
48,124
buckhx/QuadKey
quadkey/__init__.py
QuadKey.unwind
def unwind(self): """ Get a list of all ancestors in descending order of level, including a new instance of self """ return [ QuadKey(self.key[:l+1]) for l in reversed(range(len(self.key))) ]
python
def unwind(self): """ Get a list of all ancestors in descending order of level, including a new instance of self """ return [ QuadKey(self.key[:l+1]) for l in reversed(range(len(self.key))) ]
[ "def", "unwind", "(", "self", ")", ":", "return", "[", "QuadKey", "(", "self", ".", "key", "[", ":", "l", "+", "1", "]", ")", "for", "l", "in", "reversed", "(", "range", "(", "len", "(", "self", ".", "key", ")", ")", ")", "]" ]
Get a list of all ancestors in descending order of level, including a new instance of self
[ "Get", "a", "list", "of", "all", "ancestors", "in", "descending", "order", "of", "level", "including", "a", "new", "instance", "of", "self" ]
546338f9b50b578ea765d3bf84b944db48dbec5b
https://github.com/buckhx/QuadKey/blob/546338f9b50b578ea765d3bf84b944db48dbec5b/quadkey/__init__.py#L85-L88
48,125
jbittel/django-ldap-sync
ldap_sync/settings.py
LDAPSettings.validate
def validate(self): """Apply validation rules for loaded settings.""" if self.GROUP_ATTRIBUTES and self.GROUPNAME_FIELD not in self.GROUP_ATTRIBUTES.values(): raise ImproperlyConfigured("LDAP_SYNC_GROUP_ATTRIBUTES must contain '%s'" % self.GROUPNAME_FIELD) if not self.model._meta.ge...
python
def validate(self): """Apply validation rules for loaded settings.""" if self.GROUP_ATTRIBUTES and self.GROUPNAME_FIELD not in self.GROUP_ATTRIBUTES.values(): raise ImproperlyConfigured("LDAP_SYNC_GROUP_ATTRIBUTES must contain '%s'" % self.GROUPNAME_FIELD) if not self.model._meta.ge...
[ "def", "validate", "(", "self", ")", ":", "if", "self", ".", "GROUP_ATTRIBUTES", "and", "self", ".", "GROUPNAME_FIELD", "not", "in", "self", ".", "GROUP_ATTRIBUTES", ".", "values", "(", ")", ":", "raise", "ImproperlyConfigured", "(", "\"LDAP_SYNC_GROUP_ATTRIBUTE...
Apply validation rules for loaded settings.
[ "Apply", "validation", "rules", "for", "loaded", "settings", "." ]
d9ad679b32c16cf77b9d025728868fc2e1af41cd
https://github.com/jbittel/django-ldap-sync/blob/d9ad679b32c16cf77b9d025728868fc2e1af41cd/ldap_sync/settings.py#L34-L43
48,126
jbittel/django-ldap-sync
ldap_sync/search.py
LDAPSearch.search
def search(self, filterstr, attrlist): """Query the configured LDAP server.""" return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr, attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
python
def search(self, filterstr, attrlist): """Query the configured LDAP server.""" return self._paged_search_ext_s(self.settings.BASE, ldap.SCOPE_SUBTREE, filterstr=filterstr, attrlist=attrlist, page_size=self.settings.PAGE_SIZE)
[ "def", "search", "(", "self", ",", "filterstr", ",", "attrlist", ")", ":", "return", "self", ".", "_paged_search_ext_s", "(", "self", ".", "settings", ".", "BASE", ",", "ldap", ".", "SCOPE_SUBTREE", ",", "filterstr", "=", "filterstr", ",", "attrlist", "=",...
Query the configured LDAP server.
[ "Query", "the", "configured", "LDAP", "server", "." ]
d9ad679b32c16cf77b9d025728868fc2e1af41cd
https://github.com/jbittel/django-ldap-sync/blob/d9ad679b32c16cf77b9d025728868fc2e1af41cd/ldap_sync/search.py#L41-L44
48,127
tsroten/yweather
yweather.py
Client.fetch_lid
def fetch_lid(self, woeid): """Fetch a location's corresponding LID. Args: woeid: (string) the location's WOEID. Returns: a string containing the requested LID or None if the LID could not be found. Raises: urllib.error.URLError: urllib....
python
def fetch_lid(self, woeid): """Fetch a location's corresponding LID. Args: woeid: (string) the location's WOEID. Returns: a string containing the requested LID or None if the LID could not be found. Raises: urllib.error.URLError: urllib....
[ "def", "fetch_lid", "(", "self", ",", "woeid", ")", ":", "rss", "=", "self", ".", "_fetch_xml", "(", "LID_LOOKUP_URL", ".", "format", "(", "woeid", ",", "\"f\"", ")", ")", "# We are pulling the LID from the permalink tag in the XML file", "# returned by Yahoo.", "tr...
Fetch a location's corresponding LID. Args: woeid: (string) the location's WOEID. Returns: a string containing the requested LID or None if the LID could not be found. Raises: urllib.error.URLError: urllib.request could not open the URL ...
[ "Fetch", "a", "location", "s", "corresponding", "LID", "." ]
085db1df0be1925d5d7410e9160682b3a087bd61
https://github.com/tsroten/yweather/blob/085db1df0be1925d5d7410e9160682b3a087bd61/yweather.py#L107-L142
48,128
tsroten/yweather
yweather.py
Client.fetch_woeid
def fetch_woeid(self, location): """Fetch a location's corresponding WOEID. Args: location: (string) a location (e.g. 23454 or Berlin, Germany). Returns: a string containing the location's corresponding WOEID or None if the WOEID could not be found. ...
python
def fetch_woeid(self, location): """Fetch a location's corresponding WOEID. Args: location: (string) a location (e.g. 23454 or Berlin, Germany). Returns: a string containing the location's corresponding WOEID or None if the WOEID could not be found. ...
[ "def", "fetch_woeid", "(", "self", ",", "location", ")", ":", "rss", "=", "self", ".", "_fetch_xml", "(", "WOEID_LOOKUP_URL", ".", "format", "(", "quote", "(", "location", ")", ")", ")", "try", ":", "woeid", "=", "rss", ".", "find", "(", "\"results/Res...
Fetch a location's corresponding WOEID. Args: location: (string) a location (e.g. 23454 or Berlin, Germany). Returns: a string containing the location's corresponding WOEID or None if the WOEID could not be found. Raises: urllib.error.URLErr...
[ "Fetch", "a", "location", "s", "corresponding", "WOEID", "." ]
085db1df0be1925d5d7410e9160682b3a087bd61
https://github.com/tsroten/yweather/blob/085db1df0be1925d5d7410e9160682b3a087bd61/yweather.py#L273-L297
48,129
tsroten/yweather
yweather.py
Client._degrees_to_direction
def _degrees_to_direction(self, degrees): """Convert wind direction from degrees to compass direction.""" try: degrees = float(degrees) except ValueError: return None if degrees < 0 or degrees > 360: return None if degrees <= 11.25 or degrees >...
python
def _degrees_to_direction(self, degrees): """Convert wind direction from degrees to compass direction.""" try: degrees = float(degrees) except ValueError: return None if degrees < 0 or degrees > 360: return None if degrees <= 11.25 or degrees >...
[ "def", "_degrees_to_direction", "(", "self", ",", "degrees", ")", ":", "try", ":", "degrees", "=", "float", "(", "degrees", ")", "except", "ValueError", ":", "return", "None", "if", "degrees", "<", "0", "or", "degrees", ">", "360", ":", "return", "None",...
Convert wind direction from degrees to compass direction.
[ "Convert", "wind", "direction", "from", "degrees", "to", "compass", "direction", "." ]
085db1df0be1925d5d7410e9160682b3a087bd61
https://github.com/tsroten/yweather/blob/085db1df0be1925d5d7410e9160682b3a087bd61/yweather.py#L299-L340
48,130
tsroten/yweather
yweather.py
Client._fetch_xml
def _fetch_xml(self, url): """Fetch a url and parse the document's XML.""" with contextlib.closing(urlopen(url)) as f: return xml.etree.ElementTree.parse(f).getroot()
python
def _fetch_xml(self, url): """Fetch a url and parse the document's XML.""" with contextlib.closing(urlopen(url)) as f: return xml.etree.ElementTree.parse(f).getroot()
[ "def", "_fetch_xml", "(", "self", ",", "url", ")", ":", "with", "contextlib", ".", "closing", "(", "urlopen", "(", "url", ")", ")", "as", "f", ":", "return", "xml", ".", "etree", ".", "ElementTree", ".", "parse", "(", "f", ")", ".", "getroot", "(",...
Fetch a url and parse the document's XML.
[ "Fetch", "a", "url", "and", "parse", "the", "document", "s", "XML", "." ]
085db1df0be1925d5d7410e9160682b3a087bd61
https://github.com/tsroten/yweather/blob/085db1df0be1925d5d7410e9160682b3a087bd61/yweather.py#L342-L345
48,131
galaxy-genome-annotation/python-apollo
apollo/cannedvalues/__init__.py
CannedValuesClient.show_value
def show_value(self, value): """ Get a specific canned value :type value: str :param value: Canned value to show :rtype: dict :return: A dictionnary containing canned value description """ values = self.get_values() values = [x for x in values if...
python
def show_value(self, value): """ Get a specific canned value :type value: str :param value: Canned value to show :rtype: dict :return: A dictionnary containing canned value description """ values = self.get_values() values = [x for x in values if...
[ "def", "show_value", "(", "self", ",", "value", ")", ":", "values", "=", "self", ".", "get_values", "(", ")", "values", "=", "[", "x", "for", "x", "in", "values", "if", "x", "[", "'label'", "]", "==", "value", "]", "if", "len", "(", "values", ")"...
Get a specific canned value :type value: str :param value: Canned value to show :rtype: dict :return: A dictionnary containing canned value description
[ "Get", "a", "specific", "canned", "value" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/cannedvalues/__init__.py#L39-L54
48,132
galaxy-genome-annotation/python-apollo
apollo/cannedkeys/__init__.py
CannedKeysClient.show_key
def show_key(self, value): """ Get a specific canned key :type value: str :param value: Canned key to show :rtype: dict :return: A dictionnary containing canned key description """ keys = self.get_keys() keys = [x for x in keys if x['label'] == v...
python
def show_key(self, value): """ Get a specific canned key :type value: str :param value: Canned key to show :rtype: dict :return: A dictionnary containing canned key description """ keys = self.get_keys() keys = [x for x in keys if x['label'] == v...
[ "def", "show_key", "(", "self", ",", "value", ")", ":", "keys", "=", "self", ".", "get_keys", "(", ")", "keys", "=", "[", "x", "for", "x", "in", "keys", "if", "x", "[", "'label'", "]", "==", "value", "]", "if", "len", "(", "keys", ")", "==", ...
Get a specific canned key :type value: str :param value: Canned key to show :rtype: dict :return: A dictionnary containing canned key description
[ "Get", "a", "specific", "canned", "key" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/cannedkeys/__init__.py#L39-L54
48,133
cytomine/Cytomine-python-client
cytomine/models/image.py
ImageInstance.download
def download(self, dest_pattern="{originalFilename}", override=True, parent=False): """ Download the original image. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute ...
python
def download(self, dest_pattern="{originalFilename}", override=True, parent=False): """ Download the original image. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute ...
[ "def", "download", "(", "self", ",", "dest_pattern", "=", "\"{originalFilename}\"", ",", "override", "=", "True", ",", "parent", "=", "False", ")", ":", "if", "self", ".", "id", "is", "None", ":", "raise", "ValueError", "(", "\"Cannot download image with no ID...
Download the original image. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute if it exists. override : bool, optional True if a file with same name ca...
[ "Download", "the", "original", "image", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/models/image.py#L136-L167
48,134
cytomine/Cytomine-python-client
cytomine/models/image.py
ImageInstance.dump
def dump(self, dest_pattern="{id}.jpg", override=True, max_size=None, bits=8, contrast=None, gamma=None, colormap=None, inverse=None): """ Download the image with optional image modifications. Parameters ---------- dest_pattern : str, optional Destinatio...
python
def dump(self, dest_pattern="{id}.jpg", override=True, max_size=None, bits=8, contrast=None, gamma=None, colormap=None, inverse=None): """ Download the image with optional image modifications. Parameters ---------- dest_pattern : str, optional Destinatio...
[ "def", "dump", "(", "self", ",", "dest_pattern", "=", "\"{id}.jpg\"", ",", "override", "=", "True", ",", "max_size", "=", "None", ",", "bits", "=", "8", ",", "contrast", "=", "None", ",", "gamma", "=", "None", ",", "colormap", "=", "None", ",", "inve...
Download the image with optional image modifications. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute if it exists. override : bool, optional True if...
[ "Download", "the", "image", "with", "optional", "image", "modifications", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/models/image.py#L169-L235
48,135
pyecore/pyecoregen
pyecoregen/ecore.py
EcoreTask.filtered_elements
def filtered_elements(self, model): """Return iterator based on `element_type`.""" if isinstance(model, self.element_type): yield model yield from (e for e in model.eAllContents() if isinstance(e, self.element_type))
python
def filtered_elements(self, model): """Return iterator based on `element_type`.""" if isinstance(model, self.element_type): yield model yield from (e for e in model.eAllContents() if isinstance(e, self.element_type))
[ "def", "filtered_elements", "(", "self", ",", "model", ")", ":", "if", "isinstance", "(", "model", ",", "self", ".", "element_type", ")", ":", "yield", "model", "yield", "from", "(", "e", "for", "e", "in", "model", ".", "eAllContents", "(", ")", "if", ...
Return iterator based on `element_type`.
[ "Return", "iterator", "based", "on", "element_type", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L23-L27
48,136
pyecore/pyecoregen
pyecoregen/ecore.py
EcoreTask.folder_path_for_package
def folder_path_for_package(cls, package: ecore.EPackage): """Returns path to folder holding generated artifact for given element.""" parent = package.eContainer() if parent: return os.path.join(cls.folder_path_for_package(parent), package.name) return package.name
python
def folder_path_for_package(cls, package: ecore.EPackage): """Returns path to folder holding generated artifact for given element.""" parent = package.eContainer() if parent: return os.path.join(cls.folder_path_for_package(parent), package.name) return package.name
[ "def", "folder_path_for_package", "(", "cls", ",", "package", ":", "ecore", ".", "EPackage", ")", ":", "parent", "=", "package", ".", "eContainer", "(", ")", "if", "parent", ":", "return", "os", ".", "path", ".", "join", "(", "cls", ".", "folder_path_for...
Returns path to folder holding generated artifact for given element.
[ "Returns", "path", "to", "folder", "holding", "generated", "artifact", "for", "given", "element", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L30-L35
48,137
pyecore/pyecoregen
pyecoregen/ecore.py
EcorePackageInitTask.imported_classifiers_package
def imported_classifiers_package(p: ecore.EPackage): """Determines which classifiers have to be imported into given package.""" classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} references = itertools.chain(*(c.eAllReferences() for c in classes)) references_types = (r...
python
def imported_classifiers_package(p: ecore.EPackage): """Determines which classifiers have to be imported into given package.""" classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} references = itertools.chain(*(c.eAllReferences() for c in classes)) references_types = (r...
[ "def", "imported_classifiers_package", "(", "p", ":", "ecore", ".", "EPackage", ")", ":", "classes", "=", "{", "c", "for", "c", "in", "p", ".", "eClassifiers", "if", "isinstance", "(", "c", ",", "ecore", ".", "EClass", ")", "}", "references", "=", "ite...
Determines which classifiers have to be imported into given package.
[ "Determines", "which", "classifiers", "have", "to", "be", "imported", "into", "given", "package", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L59-L71
48,138
pyecore/pyecoregen
pyecoregen/ecore.py
EcorePackageModuleTask.imported_classifiers
def imported_classifiers(p: ecore.EPackage): """Determines which classifiers have to be imported into given module.""" classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} supertypes = itertools.chain(*(c.eAllSuperTypes() for c in classes)) imported = {c for c in superty...
python
def imported_classifiers(p: ecore.EPackage): """Determines which classifiers have to be imported into given module.""" classes = {c for c in p.eClassifiers if isinstance(c, ecore.EClass)} supertypes = itertools.chain(*(c.eAllSuperTypes() for c in classes)) imported = {c for c in superty...
[ "def", "imported_classifiers", "(", "p", ":", "ecore", ".", "EPackage", ")", ":", "classes", "=", "{", "c", "for", "c", "in", "p", ".", "eClassifiers", "if", "isinstance", "(", "c", ",", "ecore", ".", "EClass", ")", "}", "supertypes", "=", "itertools",...
Determines which classifiers have to be imported into given module.
[ "Determines", "which", "classifiers", "have", "to", "be", "imported", "into", "given", "module", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L87-L102
48,139
pyecore/pyecoregen
pyecoregen/ecore.py
EcorePackageModuleTask.classes
def classes(p: ecore.EPackage): """Returns classes in package in ordered by number of bases.""" classes = (c for c in p.eClassifiers if isinstance(c, ecore.EClass)) return sorted(classes, key=lambda c: len(set(c.eAllSuperTypes())))
python
def classes(p: ecore.EPackage): """Returns classes in package in ordered by number of bases.""" classes = (c for c in p.eClassifiers if isinstance(c, ecore.EClass)) return sorted(classes, key=lambda c: len(set(c.eAllSuperTypes())))
[ "def", "classes", "(", "p", ":", "ecore", ".", "EPackage", ")", ":", "classes", "=", "(", "c", "for", "c", "in", "p", ".", "eClassifiers", "if", "isinstance", "(", "c", ",", "ecore", ".", "EClass", ")", ")", "return", "sorted", "(", "classes", ",",...
Returns classes in package in ordered by number of bases.
[ "Returns", "classes", "in", "package", "in", "ordered", "by", "number", "of", "bases", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L105-L108
48,140
pyecore/pyecoregen
pyecoregen/ecore.py
EcoreGenerator.filter_pyfqn
def filter_pyfqn(cls, value, relative_to=0): """ Returns Python form of fully qualified name. Args: relative_to: If greater 0, the returned path is relative to the first n directories. """ def collect_packages(element, packages): parent = element.eContai...
python
def filter_pyfqn(cls, value, relative_to=0): """ Returns Python form of fully qualified name. Args: relative_to: If greater 0, the returned path is relative to the first n directories. """ def collect_packages(element, packages): parent = element.eContai...
[ "def", "filter_pyfqn", "(", "cls", ",", "value", ",", "relative_to", "=", "0", ")", ":", "def", "collect_packages", "(", "element", ",", "packages", ")", ":", "parent", "=", "element", ".", "eContainer", "(", ")", "if", "parent", ":", "collect_packages", ...
Returns Python form of fully qualified name. Args: relative_to: If greater 0, the returned path is relative to the first n directories.
[ "Returns", "Python", "form", "of", "fully", "qualified", "name", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L264-L289
48,141
pyecore/pyecoregen
pyecoregen/ecore.py
EcoreGenerator.create_environment
def create_environment(self, **kwargs): """ Return a new Jinja environment. Derived classes may override method to pass additional parameters or to change the template loader type. """ environment = super().create_environment(**kwargs) environment.tests.update({ ...
python
def create_environment(self, **kwargs): """ Return a new Jinja environment. Derived classes may override method to pass additional parameters or to change the template loader type. """ environment = super().create_environment(**kwargs) environment.tests.update({ ...
[ "def", "create_environment", "(", "self", ",", "*", "*", "kwargs", ")", ":", "environment", "=", "super", "(", ")", ".", "create_environment", "(", "*", "*", "kwargs", ")", "environment", ".", "tests", ".", "update", "(", "{", "'type'", ":", "self", "....
Return a new Jinja environment. Derived classes may override method to pass additional parameters or to change the template loader type.
[ "Return", "a", "new", "Jinja", "environment", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L302-L331
48,142
pyecore/pyecoregen
pyecoregen/ecore.py
EcoreGenerator.generate
def generate(self, model, outfolder, *, exclude=None): """ Generate model code. Args: model: The meta-model to generate code for. outfolder: Path to the directoty that will contain the generated code. exclude: List of referenced resources for which code was a...
python
def generate(self, model, outfolder, *, exclude=None): """ Generate model code. Args: model: The meta-model to generate code for. outfolder: Path to the directoty that will contain the generated code. exclude: List of referenced resources for which code was a...
[ "def", "generate", "(", "self", ",", "model", ",", "outfolder", ",", "*", ",", "exclude", "=", "None", ")", ":", "with", "pythonic_names", "(", ")", ":", "super", "(", ")", ".", "generate", "(", "model", ",", "outfolder", ")", "check_dependency", "=", ...
Generate model code. Args: model: The meta-model to generate code for. outfolder: Path to the directoty that will contain the generated code. exclude: List of referenced resources for which code was already generated (to prevent regeneration).
[ "Generate", "model", "code", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/ecore.py#L333-L356
48,143
galaxy-genome-annotation/python-apollo
apollo/groups/__init__.py
GroupsClient.show_group
def show_group(self, group_id): """ Get information about a group :type group_id: int :param group_id: Group ID Number :rtype: dict :return: a dictionary containing group information """ res = self.post('loadGroups', {'groupId': group_id}) if isi...
python
def show_group(self, group_id): """ Get information about a group :type group_id: int :param group_id: Group ID Number :rtype: dict :return: a dictionary containing group information """ res = self.post('loadGroups', {'groupId': group_id}) if isi...
[ "def", "show_group", "(", "self", ",", "group_id", ")", ":", "res", "=", "self", ".", "post", "(", "'loadGroups'", ",", "{", "'groupId'", ":", "group_id", "}", ")", "if", "isinstance", "(", "res", ",", "list", ")", ":", "return", "_fix_group", "(", "...
Get information about a group :type group_id: int :param group_id: Group ID Number :rtype: dict :return: a dictionary containing group information
[ "Get", "information", "about", "a", "group" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/groups/__init__.py#L41-L55
48,144
galaxy-genome-annotation/python-apollo
apollo/groups/__init__.py
GroupsClient.get_organism_permissions
def get_organism_permissions(self, group): """ Get the group's organism permissions :type group: str :param group: group name :rtype: list :return: a list containing organism permissions (if any) """ data = { 'name': group, } ...
python
def get_organism_permissions(self, group): """ Get the group's organism permissions :type group: str :param group: group name :rtype: list :return: a list containing organism permissions (if any) """ data = { 'name': group, } ...
[ "def", "get_organism_permissions", "(", "self", ",", "group", ")", ":", "data", "=", "{", "'name'", ":", "group", ",", "}", "response", "=", "_fix_group", "(", "self", ".", "post", "(", "'getOrganismPermissionsForGroup'", ",", "data", ")", ")", "return", "...
Get the group's organism permissions :type group: str :param group: group name :rtype: list :return: a list containing organism permissions (if any)
[ "Get", "the", "group", "s", "organism", "permissions" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/groups/__init__.py#L94-L108
48,145
galaxy-genome-annotation/python-apollo
apollo/groups/__init__.py
GroupsClient.get_group_admin
def get_group_admin(self, group): """ Get the group's admins :type group: str :param group: group name :rtype: list :return: a list containing group admins """ data = { 'name': group, } response = _fix_group(self.post('getGrou...
python
def get_group_admin(self, group): """ Get the group's admins :type group: str :param group: group name :rtype: list :return: a list containing group admins """ data = { 'name': group, } response = _fix_group(self.post('getGrou...
[ "def", "get_group_admin", "(", "self", ",", "group", ")", ":", "data", "=", "{", "'name'", ":", "group", ",", "}", "response", "=", "_fix_group", "(", "self", ".", "post", "(", "'getGroupAdmin'", ",", "data", ")", ")", "return", "response" ]
Get the group's admins :type group: str :param group: group name :rtype: list :return: a list containing group admins
[ "Get", "the", "group", "s", "admins" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/groups/__init__.py#L187-L201
48,146
galaxy-genome-annotation/python-apollo
apollo/groups/__init__.py
GroupsClient.get_group_creator
def get_group_creator(self, group): """ Get the group's creator :type group: str :param group: group name :rtype: list :return: creator userId """ data = { 'name': group, } response = _fix_group(self.post('getGroupCreator', da...
python
def get_group_creator(self, group): """ Get the group's creator :type group: str :param group: group name :rtype: list :return: creator userId """ data = { 'name': group, } response = _fix_group(self.post('getGroupCreator', da...
[ "def", "get_group_creator", "(", "self", ",", "group", ")", ":", "data", "=", "{", "'name'", ":", "group", ",", "}", "response", "=", "_fix_group", "(", "self", ".", "post", "(", "'getGroupCreator'", ",", "data", ")", ")", "return", "response" ]
Get the group's creator :type group: str :param group: group name :rtype: list :return: creator userId
[ "Get", "the", "group", "s", "creator" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/groups/__init__.py#L203-L217
48,147
globocom/tornado-es
tornadoes/__init__.py
ESConnection._create_query_string
def _create_query_string(params): """ Support Elasticsearch 5.X """ parameters = params or {} for param, value in parameters.items(): param_value = str(value).lower() if isinstance(value, bool) else value parameters[param] = param_value return ur...
python
def _create_query_string(params): """ Support Elasticsearch 5.X """ parameters = params or {} for param, value in parameters.items(): param_value = str(value).lower() if isinstance(value, bool) else value parameters[param] = param_value return ur...
[ "def", "_create_query_string", "(", "params", ")", ":", "parameters", "=", "params", "or", "{", "}", "for", "param", ",", "value", "in", "parameters", ".", "items", "(", ")", ":", "param_value", "=", "str", "(", "value", ")", ".", "lower", "(", ")", ...
Support Elasticsearch 5.X
[ "Support", "Elasticsearch", "5", ".", "X" ]
f805ba766db1d4f3119583490aa99dbb71ad5680
https://github.com/globocom/tornado-es/blob/f805ba766db1d4f3119583490aa99dbb71ad5680/tornadoes/__init__.py#L26-L36
48,148
galaxy-genome-annotation/python-apollo
apollo/status/__init__.py
StatusClient.show_status
def show_status(self, status): """ Get a specific status :type status: str :param status: Status to show :rtype: dict :return: A dictionnary containing status description """ statuses = self.get_statuses() statuses = [x for x in statuses if x['va...
python
def show_status(self, status): """ Get a specific status :type status: str :param status: Status to show :rtype: dict :return: A dictionnary containing status description """ statuses = self.get_statuses() statuses = [x for x in statuses if x['va...
[ "def", "show_status", "(", "self", ",", "status", ")", ":", "statuses", "=", "self", ".", "get_statuses", "(", ")", "statuses", "=", "[", "x", "for", "x", "in", "statuses", "if", "x", "[", "'value'", "]", "==", "status", "]", "if", "len", "(", "sta...
Get a specific status :type status: str :param status: Status to show :rtype: dict :return: A dictionnary containing status description
[ "Get", "a", "specific", "status" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/status/__init__.py#L35-L50
48,149
galaxy-genome-annotation/python-apollo
apollo/annotations/__init__.py
AnnotationsClient.add_attribute
def add_attribute(self, feature_id, attribute_key, attribute_value, organism=None, sequence=None): """ Add an attribute to a feature :type feature_id: str :param feature_id: Feature UUID :type attribute_key: str :param attribute_key: Attribute Key :type attribu...
python
def add_attribute(self, feature_id, attribute_key, attribute_value, organism=None, sequence=None): """ Add an attribute to a feature :type feature_id: str :param feature_id: Feature UUID :type attribute_key: str :param attribute_key: Attribute Key :type attribu...
[ "def", "add_attribute", "(", "self", ",", "feature_id", ",", "attribute_key", ",", "attribute_value", ",", "organism", "=", "None", ",", "sequence", "=", "None", ")", ":", "data", "=", "{", "'features'", ":", "[", "{", "'uniquename'", ":", "feature_id", ",...
Add an attribute to a feature :type feature_id: str :param feature_id: Feature UUID :type attribute_key: str :param attribute_key: Attribute Key :type attribute_value: str :param attribute_value: Attribute Value :type organism: str :param organism: Org...
[ "Add", "an", "attribute", "to", "a", "feature" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/annotations/__init__.py#L216-L254
48,150
galaxy-genome-annotation/python-apollo
apollo/annotations/__init__.py
AnnotationsClient.add_dbxref
def add_dbxref(self, feature_id, db, accession, organism=None, sequence=None): """ Add a dbxref to a feature :type feature_id: str :param feature_id: Feature UUID :type db: str :param db: DB Name (e.g. PMID) :type accession: str :param accession: Access...
python
def add_dbxref(self, feature_id, db, accession, organism=None, sequence=None): """ Add a dbxref to a feature :type feature_id: str :param feature_id: Feature UUID :type db: str :param db: DB Name (e.g. PMID) :type accession: str :param accession: Access...
[ "def", "add_dbxref", "(", "self", ",", "feature_id", ",", "db", ",", "accession", ",", "organism", "=", "None", ",", "sequence", "=", "None", ")", ":", "data", "=", "{", "'features'", ":", "[", "{", "'uniquename'", ":", "feature_id", ",", "'dbxrefs'", ...
Add a dbxref to a feature :type feature_id: str :param feature_id: Feature UUID :type db: str :param db: DB Name (e.g. PMID) :type accession: str :param accession: Accession Value :type organism: str :param organism: Organism Common Name :type...
[ "Add", "a", "dbxref", "to", "a", "feature" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/annotations/__init__.py#L341-L379
48,151
galaxy-genome-annotation/python-apollo
apollo/users/__init__.py
UsersClient._handle_empty
def _handle_empty(self, user, response): """Apollo likes to return empty user arrays, even when you REALLY want a user response back... like creating a user.""" if len(response.keys()) == 0: response = self.show_user(user) # And sometimes show_user can return nothing. As...
python
def _handle_empty(self, user, response): """Apollo likes to return empty user arrays, even when you REALLY want a user response back... like creating a user.""" if len(response.keys()) == 0: response = self.show_user(user) # And sometimes show_user can return nothing. As...
[ "def", "_handle_empty", "(", "self", ",", "user", ",", "response", ")", ":", "if", "len", "(", "response", ".", "keys", "(", ")", ")", "==", "0", ":", "response", "=", "self", ".", "show_user", "(", "user", ")", "# And sometimes show_user can return nothin...
Apollo likes to return empty user arrays, even when you REALLY want a user response back... like creating a user.
[ "Apollo", "likes", "to", "return", "empty", "user", "arrays", "even", "when", "you", "REALLY", "want", "a", "user", "response", "back", "...", "like", "creating", "a", "user", "." ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/users/__init__.py#L41-L50
48,152
galaxy-genome-annotation/python-apollo
apollo/users/__init__.py
UsersClient.show_user
def show_user(self, user): """ Get a specific user :type user: str :param user: User Email :rtype: dict :return: a dictionary containing user information """ res = self.post('loadUsers', {'userId': user}) if isinstance(res, list) and len(res) > 0...
python
def show_user(self, user): """ Get a specific user :type user: str :param user: User Email :rtype: dict :return: a dictionary containing user information """ res = self.post('loadUsers', {'userId': user}) if isinstance(res, list) and len(res) > 0...
[ "def", "show_user", "(", "self", ",", "user", ")", ":", "res", "=", "self", ".", "post", "(", "'loadUsers'", ",", "{", "'userId'", ":", "user", "}", ")", "if", "isinstance", "(", "res", ",", "list", ")", "and", "len", "(", "res", ")", ">", "0", ...
Get a specific user :type user: str :param user: User Email :rtype: dict :return: a dictionary containing user information
[ "Get", "a", "specific", "user" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/users/__init__.py#L69-L82
48,153
galaxy-genome-annotation/python-apollo
apollo/__init__.py
require_user
def require_user(wa, email): """Require that the user has an account""" cache_key = 'user-list' try: # Get the cached value data = userCache[cache_key] except KeyError: # If we hit a key error above, indicating that # we couldn't find the key, we'll simply re-request ...
python
def require_user(wa, email): """Require that the user has an account""" cache_key = 'user-list' try: # Get the cached value data = userCache[cache_key] except KeyError: # If we hit a key error above, indicating that # we couldn't find the key, we'll simply re-request ...
[ "def", "require_user", "(", "wa", ",", "email", ")", ":", "cache_key", "=", "'user-list'", "try", ":", "# Get the cached value", "data", "=", "userCache", "[", "cache_key", "]", "except", "KeyError", ":", "# If we hit a key error above, indicating that", "# we couldn'...
Require that the user has an account
[ "Require", "that", "the", "user", "has", "an", "account" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/__init__.py#L49-L62
48,154
galaxy-genome-annotation/python-apollo
apollo/__init__.py
accessible_organisms
def accessible_organisms(user, orgs): """Get the list of organisms accessible to a user, filtered by `orgs`""" permission_map = { x['organism']: x['permissions'] for x in user.organismPermissions if 'WRITE' in x['permissions'] or 'READ' in x['permissions'] or 'ADMINISTRAT...
python
def accessible_organisms(user, orgs): """Get the list of organisms accessible to a user, filtered by `orgs`""" permission_map = { x['organism']: x['permissions'] for x in user.organismPermissions if 'WRITE' in x['permissions'] or 'READ' in x['permissions'] or 'ADMINISTRAT...
[ "def", "accessible_organisms", "(", "user", ",", "orgs", ")", ":", "permission_map", "=", "{", "x", "[", "'organism'", "]", ":", "x", "[", "'permissions'", "]", "for", "x", "in", "user", ".", "organismPermissions", "if", "'WRITE'", "in", "x", "[", "'perm...
Get the list of organisms accessible to a user, filtered by `orgs`
[ "Get", "the", "list", "of", "organisms", "accessible", "to", "a", "user", "filtered", "by", "orgs" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/__init__.py#L65-L83
48,155
cytomine/Cytomine-python-client
cytomine/cytomine.py
Cytomine.connect
def connect(cls, host, public_key, private_key, verbose=0, use_cache=True): """ Connect the client with the given host and the provided credentials. Parameters ---------- host : str The Cytomine host (without protocol). public_key : str The Cytomi...
python
def connect(cls, host, public_key, private_key, verbose=0, use_cache=True): """ Connect the client with the given host and the provided credentials. Parameters ---------- host : str The Cytomine host (without protocol). public_key : str The Cytomi...
[ "def", "connect", "(", "cls", ",", "host", ",", "public_key", ",", "private_key", ",", "verbose", "=", "0", ",", "use_cache", "=", "True", ")", ":", "return", "cls", "(", "host", ",", "public_key", ",", "private_key", ",", "verbose", ",", "use_cache", ...
Connect the client with the given host and the provided credentials. Parameters ---------- host : str The Cytomine host (without protocol). public_key : str The Cytomine public key. private_key : str The Cytomine private key. verbose :...
[ "Connect", "the", "client", "with", "the", "given", "host", "and", "the", "provided", "credentials", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine.py#L151-L173
48,156
cytomine/Cytomine-python-client
cytomine/cytomine.py
Cytomine.connect_from_cli
def connect_from_cli(cls, argv, use_cache=True): """ Connect with data taken from a command line interface. Parameters ---------- argv: list Command line parameters (executable name excluded) use_cache : bool True to use HTTP cache, False otherwis...
python
def connect_from_cli(cls, argv, use_cache=True): """ Connect with data taken from a command line interface. Parameters ---------- argv: list Command line parameters (executable name excluded) use_cache : bool True to use HTTP cache, False otherwis...
[ "def", "connect_from_cli", "(", "cls", ",", "argv", ",", "use_cache", "=", "True", ")", ":", "argparse", "=", "cls", ".", "_add_cytomine_cli_args", "(", "ArgumentParser", "(", ")", ")", "params", ",", "_", "=", "argparse", ".", "parse_known_args", "(", "ar...
Connect with data taken from a command line interface. Parameters ---------- argv: list Command line parameters (executable name excluded) use_cache : bool True to use HTTP cache, False otherwise. Returns ------- client : Cytomine ...
[ "Connect", "with", "data", "taken", "from", "a", "command", "line", "interface", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine.py#L176-L201
48,157
cytomine/Cytomine-python-client
cytomine/cytomine.py
Cytomine._parse_url
def _parse_url(host, provided_protocol=None): """ Process the provided host and protocol to return them in a standardized way that can be subsequently used by Cytomine methods. If the protocol is not specified, HTTP is the default. Only HTTP and HTTPS schemes are supported. ...
python
def _parse_url(host, provided_protocol=None): """ Process the provided host and protocol to return them in a standardized way that can be subsequently used by Cytomine methods. If the protocol is not specified, HTTP is the default. Only HTTP and HTTPS schemes are supported. ...
[ "def", "_parse_url", "(", "host", ",", "provided_protocol", "=", "None", ")", ":", "protocol", "=", "\"http\"", "# default protocol", "if", "host", ".", "startswith", "(", "\"http://\"", ")", ":", "protocol", "=", "\"http\"", "elif", "host", ".", "startswith",...
Process the provided host and protocol to return them in a standardized way that can be subsequently used by Cytomine methods. If the protocol is not specified, HTTP is the default. Only HTTP and HTTPS schemes are supported. Parameters ---------- host: str Th...
[ "Process", "the", "provided", "host", "and", "protocol", "to", "return", "them", "in", "a", "standardized", "way", "that", "can", "be", "subsequently", "used", "by", "Cytomine", "methods", ".", "If", "the", "protocol", "is", "not", "specified", "HTTP", "is",...
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine.py#L234-L276
48,158
cytomine/Cytomine-python-client
cytomine/cytomine.py
Cytomine.upload_crop
def upload_crop(self, ims_host, filename, id_annot, id_storage, id_project=None, sync=False, protocol=None): """ Upload the crop associated with an annotation as a new image. Parameters ---------- ims_host: str Cytomine IMS host, with or without the ...
python
def upload_crop(self, ims_host, filename, id_annot, id_storage, id_project=None, sync=False, protocol=None): """ Upload the crop associated with an annotation as a new image. Parameters ---------- ims_host: str Cytomine IMS host, with or without the ...
[ "def", "upload_crop", "(", "self", ",", "ims_host", ",", "filename", ",", "id_annot", ",", "id_storage", ",", "id_project", "=", "None", ",", "sync", "=", "False", ",", "protocol", "=", "None", ")", ":", "if", "not", "protocol", ":", "protocol", "=", "...
Upload the crop associated with an annotation as a new image. Parameters ---------- ims_host: str Cytomine IMS host, with or without the protocol filename: str Filename to give to the newly created image id_annot: int Identifier of the annotat...
[ "Upload", "the", "crop", "associated", "with", "an", "annotation", "as", "a", "new", "image", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine.py#L594-L655
48,159
galaxy-genome-annotation/python-apollo
apollo/cannedcomments/__init__.py
CannedCommentsClient.show_comment
def show_comment(self, value): """ Get a specific canned comment :type value: str :param value: Canned comment to show :rtype: dict :return: A dictionnary containing canned comment description """ comments = self.get_comments() comments = [x for ...
python
def show_comment(self, value): """ Get a specific canned comment :type value: str :param value: Canned comment to show :rtype: dict :return: A dictionnary containing canned comment description """ comments = self.get_comments() comments = [x for ...
[ "def", "show_comment", "(", "self", ",", "value", ")", ":", "comments", "=", "self", ".", "get_comments", "(", ")", "comments", "=", "[", "x", "for", "x", "in", "comments", "if", "x", "[", "'comment'", "]", "==", "value", "]", "if", "len", "(", "co...
Get a specific canned comment :type value: str :param value: Canned comment to show :rtype: dict :return: A dictionnary containing canned comment description
[ "Get", "a", "specific", "canned", "comment" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/cannedcomments/__init__.py#L39-L54
48,160
galaxy-genome-annotation/python-apollo
arrow/cli.py
arrow
def arrow(ctx, apollo_instance, verbose, log_level): """Command line wrappers around Apollo functions. While this sounds unexciting, with arrow and jq you can easily build powerful command line scripts.""" set_logging_level(log_level) # We abuse this, knowing that calls to one will fail. try: ...
python
def arrow(ctx, apollo_instance, verbose, log_level): """Command line wrappers around Apollo functions. While this sounds unexciting, with arrow and jq you can easily build powerful command line scripts.""" set_logging_level(log_level) # We abuse this, knowing that calls to one will fail. try: ...
[ "def", "arrow", "(", "ctx", ",", "apollo_instance", ",", "verbose", ",", "log_level", ")", ":", "set_logging_level", "(", "log_level", ")", "# We abuse this, knowing that calls to one will fail.", "try", ":", "ctx", ".", "gi", "=", "get_apollo_instance", "(", "apoll...
Command line wrappers around Apollo functions. While this sounds unexciting, with arrow and jq you can easily build powerful command line scripts.
[ "Command", "line", "wrappers", "around", "Apollo", "functions", ".", "While", "this", "sounds", "unexciting", "with", "arrow", "and", "jq", "you", "can", "easily", "build", "powerful", "command", "line", "scripts", "." ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/arrow/cli.py#L134-L147
48,161
galaxy-genome-annotation/python-apollo
arrow/cli.py
json_loads
def json_loads(data): """Load json data, allowing - to represent stdin.""" if data is None: return "" if data == "-": return json.load(sys.stdin) elif os.path.exists(data): with open(data, 'r') as handle: return json.load(handle) else: return json.loads(d...
python
def json_loads(data): """Load json data, allowing - to represent stdin.""" if data is None: return "" if data == "-": return json.load(sys.stdin) elif os.path.exists(data): with open(data, 'r') as handle: return json.load(handle) else: return json.loads(d...
[ "def", "json_loads", "(", "data", ")", ":", "if", "data", "is", "None", ":", "return", "\"\"", "if", "data", "==", "\"-\"", ":", "return", "json", ".", "load", "(", "sys", ".", "stdin", ")", "elif", "os", ".", "path", ".", "exists", "(", "data", ...
Load json data, allowing - to represent stdin.
[ "Load", "json", "data", "allowing", "-", "to", "represent", "stdin", "." ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/arrow/cli.py#L150-L161
48,162
maykinmedia/django-timeline-logger
timeline_logger/management/commands/report_mailing.py
Command.get_queryset
def get_queryset(self, **options): """ Filters the list of log objects to display """ days = options.get('days') queryset = TimelineLog.objects.order_by('-timestamp') if days: try: start = timezone.now() - timedelta(days=days) excep...
python
def get_queryset(self, **options): """ Filters the list of log objects to display """ days = options.get('days') queryset = TimelineLog.objects.order_by('-timestamp') if days: try: start = timezone.now() - timedelta(days=days) excep...
[ "def", "get_queryset", "(", "self", ",", "*", "*", "options", ")", ":", "days", "=", "options", ".", "get", "(", "'days'", ")", "queryset", "=", "TimelineLog", ".", "objects", ".", "order_by", "(", "'-timestamp'", ")", "if", "days", ":", "try", ":", ...
Filters the list of log objects to display
[ "Filters", "the", "list", "of", "log", "objects", "to", "display" ]
1bc67b6283eb94c84e0936e3a882e1b63cfb5ed3
https://github.com/maykinmedia/django-timeline-logger/blob/1bc67b6283eb94c84e0936e3a882e1b63cfb5ed3/timeline_logger/management/commands/report_mailing.py#L47-L61
48,163
maykinmedia/django-timeline-logger
timeline_logger/management/commands/report_mailing.py
Command.get_recipients
def get_recipients(self, **options): """ Figures out the recipients """ if options['recipients_from_setting']: return settings.TIMELINE_DIGEST_EMAIL_RECIPIENTS users = get_user_model()._default_manager.all() if options['staff']: users = users.filt...
python
def get_recipients(self, **options): """ Figures out the recipients """ if options['recipients_from_setting']: return settings.TIMELINE_DIGEST_EMAIL_RECIPIENTS users = get_user_model()._default_manager.all() if options['staff']: users = users.filt...
[ "def", "get_recipients", "(", "self", ",", "*", "*", "options", ")", ":", "if", "options", "[", "'recipients_from_setting'", "]", ":", "return", "settings", ".", "TIMELINE_DIGEST_EMAIL_RECIPIENTS", "users", "=", "get_user_model", "(", ")", ".", "_default_manager",...
Figures out the recipients
[ "Figures", "out", "the", "recipients" ]
1bc67b6283eb94c84e0936e3a882e1b63cfb5ed3
https://github.com/maykinmedia/django-timeline-logger/blob/1bc67b6283eb94c84e0936e3a882e1b63cfb5ed3/timeline_logger/management/commands/report_mailing.py#L63-L75
48,164
bouncer-app/bouncer
bouncer/models.py
Ability.expand_actions
def expand_actions(self, actions): """Accepts an array of actions and returns an array of actions which match. This should be called before "matches?" and other checking methods since they rely on the actions to be expanded.""" results = list() for action in actions: ...
python
def expand_actions(self, actions): """Accepts an array of actions and returns an array of actions which match. This should be called before "matches?" and other checking methods since they rely on the actions to be expanded.""" results = list() for action in actions: ...
[ "def", "expand_actions", "(", "self", ",", "actions", ")", ":", "results", "=", "list", "(", ")", "for", "action", "in", "actions", ":", "if", "action", "in", "self", ".", "aliased_actions", ":", "results", ".", "append", "(", "action", ")", "for", "it...
Accepts an array of actions and returns an array of actions which match. This should be called before "matches?" and other checking methods since they rely on the actions to be expanded.
[ "Accepts", "an", "array", "of", "actions", "and", "returns", "an", "array", "of", "actions", "which", "match", ".", "This", "should", "be", "called", "before", "matches?", "and", "other", "checking", "methods", "since", "they", "rely", "on", "the", "actions"...
2d645dce18e3849d338d21380529abf8db5eeb9d
https://github.com/bouncer-app/bouncer/blob/2d645dce18e3849d338d21380529abf8db5eeb9d/bouncer/models.py#L190-L204
48,165
cytomine/Cytomine-python-client
cytomine/cytomine_job.py
_software_params_to_argparse
def _software_params_to_argparse(parameters): """ Converts a SoftwareParameterCollection into an ArgumentParser object. Parameters ---------- parameters: SoftwareParameterCollection The software parameters Returns ------- argparse: ArgumentParser An initialized argument ...
python
def _software_params_to_argparse(parameters): """ Converts a SoftwareParameterCollection into an ArgumentParser object. Parameters ---------- parameters: SoftwareParameterCollection The software parameters Returns ------- argparse: ArgumentParser An initialized argument ...
[ "def", "_software_params_to_argparse", "(", "parameters", ")", ":", "# Check software parameters", "argparse", "=", "ArgumentParser", "(", ")", "boolean_defaults", "=", "{", "}", "for", "parameter", "in", "parameters", ":", "arg_desc", "=", "{", "\"dest\"", ":", "...
Converts a SoftwareParameterCollection into an ArgumentParser object. Parameters ---------- parameters: SoftwareParameterCollection The software parameters Returns ------- argparse: ArgumentParser An initialized argument parser
[ "Converts", "a", "SoftwareParameterCollection", "into", "an", "ArgumentParser", "object", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine_job.py#L80-L108
48,166
cytomine/Cytomine-python-client
cytomine/cytomine_job.py
CytomineJob.start
def start(self): """ Connect to the Cytomine server and switch to job connection Incurs dataflows """ run_by_ui = False if not self.current_user.algo: # If user connects as a human (CLI execution) self._job = Job(self._project.id, self._software.i...
python
def start(self): """ Connect to the Cytomine server and switch to job connection Incurs dataflows """ run_by_ui = False if not self.current_user.algo: # If user connects as a human (CLI execution) self._job = Job(self._project.id, self._software.i...
[ "def", "start", "(", "self", ")", ":", "run_by_ui", "=", "False", "if", "not", "self", ".", "current_user", ".", "algo", ":", "# If user connects as a human (CLI execution)", "self", ".", "_job", "=", "Job", "(", "self", ".", "_project", ".", "id", ",", "s...
Connect to the Cytomine server and switch to job connection Incurs dataflows
[ "Connect", "to", "the", "Cytomine", "server", "and", "switch", "to", "job", "connection", "Incurs", "dataflows" ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine_job.py#L257-L288
48,167
cytomine/Cytomine-python-client
cytomine/cytomine_job.py
CytomineJob.close
def close(self, value): """ Notify the Cytomine server of the job's end Incurs a dataflows """ if value is None: status = Job.TERMINATED status_comment = "Job successfully terminated" else: status = Job.FAILED status_comment...
python
def close(self, value): """ Notify the Cytomine server of the job's end Incurs a dataflows """ if value is None: status = Job.TERMINATED status_comment = "Job successfully terminated" else: status = Job.FAILED status_comment...
[ "def", "close", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "status", "=", "Job", ".", "TERMINATED", "status_comment", "=", "\"Job successfully terminated\"", "else", ":", "status", "=", "Job", ".", "FAILED", "status_comment", "=",...
Notify the Cytomine server of the job's end Incurs a dataflows
[ "Notify", "the", "Cytomine", "server", "of", "the", "job", "s", "end", "Incurs", "a", "dataflows" ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/cytomine_job.py#L290-L304
48,168
pyecore/pyecoregen
pyecoregen/cli.py
generate_from_cli
def generate_from_cli(args): """CLI entry point.""" parser = argparse.ArgumentParser(description="Generate Python classes from an Ecore model.") parser.add_argument( '--ecore-model', '-e', help="Path to Ecore XMI file.", required=True ) parser.add_argument( '-...
python
def generate_from_cli(args): """CLI entry point.""" parser = argparse.ArgumentParser(description="Generate Python classes from an Ecore model.") parser.add_argument( '--ecore-model', '-e', help="Path to Ecore XMI file.", required=True ) parser.add_argument( '-...
[ "def", "generate_from_cli", "(", "args", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "\"Generate Python classes from an Ecore model.\"", ")", "parser", ".", "add_argument", "(", "'--ecore-model'", ",", "'-e'", ",", "help", "=...
CLI entry point.
[ "CLI", "entry", "point", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/cli.py#L18-L62
48,169
pyecore/pyecoregen
pyecoregen/cli.py
select_uri_implementation
def select_uri_implementation(ecore_model_path): """Select the right URI implementation regarding the Ecore model path schema.""" if URL_PATTERN.match(ecore_model_path): return pyecore.resources.resource.HttpURI return pyecore.resources.URI
python
def select_uri_implementation(ecore_model_path): """Select the right URI implementation regarding the Ecore model path schema.""" if URL_PATTERN.match(ecore_model_path): return pyecore.resources.resource.HttpURI return pyecore.resources.URI
[ "def", "select_uri_implementation", "(", "ecore_model_path", ")", ":", "if", "URL_PATTERN", ".", "match", "(", "ecore_model_path", ")", ":", "return", "pyecore", ".", "resources", ".", "resource", ".", "HttpURI", "return", "pyecore", ".", "resources", ".", "URI"...
Select the right URI implementation regarding the Ecore model path schema.
[ "Select", "the", "right", "URI", "implementation", "regarding", "the", "Ecore", "model", "path", "schema", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/cli.py#L77-L81
48,170
pyecore/pyecoregen
pyecoregen/cli.py
load_model
def load_model(ecore_model_path): """Load a single Ecore model and return the root package.""" rset = pyecore.resources.ResourceSet() uri_implementation = select_uri_implementation(ecore_model_path) resource = rset.get_resource(uri_implementation(ecore_model_path)) return resource.contents[0]
python
def load_model(ecore_model_path): """Load a single Ecore model and return the root package.""" rset = pyecore.resources.ResourceSet() uri_implementation = select_uri_implementation(ecore_model_path) resource = rset.get_resource(uri_implementation(ecore_model_path)) return resource.contents[0]
[ "def", "load_model", "(", "ecore_model_path", ")", ":", "rset", "=", "pyecore", ".", "resources", ".", "ResourceSet", "(", ")", "uri_implementation", "=", "select_uri_implementation", "(", "ecore_model_path", ")", "resource", "=", "rset", ".", "get_resource", "(",...
Load a single Ecore model and return the root package.
[ "Load", "a", "single", "Ecore", "model", "and", "return", "the", "root", "package", "." ]
8c7a792f46d7d94e5d13e00e2967dd237351a4cf
https://github.com/pyecore/pyecoregen/blob/8c7a792f46d7d94e5d13e00e2967dd237351a4cf/pyecoregen/cli.py#L84-L89
48,171
galaxy-genome-annotation/python-apollo
apollo/client.py
Client.post
def post(self, client_method, data, post_params=None, is_json=True): """Make a POST request""" url = self._wa.apollo_url + self.CLIENT_BASE + client_method if post_params is None: post_params = {} headers = { 'Content-Type': 'application/json' } ...
python
def post(self, client_method, data, post_params=None, is_json=True): """Make a POST request""" url = self._wa.apollo_url + self.CLIENT_BASE + client_method if post_params is None: post_params = {} headers = { 'Content-Type': 'application/json' } ...
[ "def", "post", "(", "self", ",", "client_method", ",", "data", ",", "post_params", "=", "None", ",", "is_json", "=", "True", ")", ":", "url", "=", "self", ".", "_wa", ".", "apollo_url", "+", "self", ".", "CLIENT_BASE", "+", "client_method", "if", "post...
Make a POST request
[ "Make", "a", "POST", "request" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/client.py#L29-L65
48,172
galaxy-genome-annotation/python-apollo
apollo/client.py
Client.get
def get(self, client_method, get_params, is_json=True): """Make a GET request""" url = self._wa.apollo_url + self.CLIENT_BASE + client_method headers = {} response = requests.get(url, headers=headers, verify=self.__verify, params=get_params, ...
python
def get(self, client_method, get_params, is_json=True): """Make a GET request""" url = self._wa.apollo_url + self.CLIENT_BASE + client_method headers = {} response = requests.get(url, headers=headers, verify=self.__verify, params=get_params, ...
[ "def", "get", "(", "self", ",", "client_method", ",", "get_params", ",", "is_json", "=", "True", ")", ":", "url", "=", "self", ".", "_wa", ".", "apollo_url", "+", "self", ".", "CLIENT_BASE", "+", "client_method", "headers", "=", "{", "}", "response", "...
Make a GET request
[ "Make", "a", "GET", "request" ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/apollo/client.py#L67-L83
48,173
bouncer-app/bouncer
bouncer/__init__.py
can
def can(user, action, subject): """Checks if a given user has the ability to perform the action on a subject :param user: A user object :param action: an action string, typically 'read', 'edit', 'manage'. Use bouncer.constants for readability :param subject: the resource in question. Either a Class o...
python
def can(user, action, subject): """Checks if a given user has the ability to perform the action on a subject :param user: A user object :param action: an action string, typically 'read', 'edit', 'manage'. Use bouncer.constants for readability :param subject: the resource in question. Either a Class o...
[ "def", "can", "(", "user", ",", "action", ",", "subject", ")", ":", "ability", "=", "Ability", "(", "user", ",", "get_authorization_method", "(", ")", ")", "return", "ability", ".", "can", "(", "action", ",", "subject", ")" ]
Checks if a given user has the ability to perform the action on a subject :param user: A user object :param action: an action string, typically 'read', 'edit', 'manage'. Use bouncer.constants for readability :param subject: the resource in question. Either a Class or an instance of a class. Pass the cla...
[ "Checks", "if", "a", "given", "user", "has", "the", "ability", "to", "perform", "the", "action", "on", "a", "subject" ]
2d645dce18e3849d338d21380529abf8db5eeb9d
https://github.com/bouncer-app/bouncer/blob/2d645dce18e3849d338d21380529abf8db5eeb9d/bouncer/__init__.py#L16-L28
48,174
bouncer-app/bouncer
bouncer/__init__.py
cannot
def cannot(user, action, subject): """inverse of ``can``""" ability = Ability(user, get_authorization_method()) return ability.cannot(action, subject)
python
def cannot(user, action, subject): """inverse of ``can``""" ability = Ability(user, get_authorization_method()) return ability.cannot(action, subject)
[ "def", "cannot", "(", "user", ",", "action", ",", "subject", ")", ":", "ability", "=", "Ability", "(", "user", ",", "get_authorization_method", "(", ")", ")", "return", "ability", ".", "cannot", "(", "action", ",", "subject", ")" ]
inverse of ``can``
[ "inverse", "of", "can" ]
2d645dce18e3849d338d21380529abf8db5eeb9d
https://github.com/bouncer-app/bouncer/blob/2d645dce18e3849d338d21380529abf8db5eeb9d/bouncer/__init__.py#L31-L34
48,175
bouncer-app/bouncer
bouncer/__init__.py
ensure
def ensure(user, action, subject): """ Similar to ``can`` but will raise a AccessDenied Exception if does not have access""" ability = Ability(user, get_authorization_method()) if ability.cannot(action, subject): raise AccessDenied()
python
def ensure(user, action, subject): """ Similar to ``can`` but will raise a AccessDenied Exception if does not have access""" ability = Ability(user, get_authorization_method()) if ability.cannot(action, subject): raise AccessDenied()
[ "def", "ensure", "(", "user", ",", "action", ",", "subject", ")", ":", "ability", "=", "Ability", "(", "user", ",", "get_authorization_method", "(", ")", ")", "if", "ability", ".", "cannot", "(", "action", ",", "subject", ")", ":", "raise", "AccessDenied...
Similar to ``can`` but will raise a AccessDenied Exception if does not have access
[ "Similar", "to", "can", "but", "will", "raise", "a", "AccessDenied", "Exception", "if", "does", "not", "have", "access" ]
2d645dce18e3849d338d21380529abf8db5eeb9d
https://github.com/bouncer-app/bouncer/blob/2d645dce18e3849d338d21380529abf8db5eeb9d/bouncer/__init__.py#L37-L41
48,176
cytomine/Cytomine-python-client
cytomine/models/annotation.py
Annotation.dump
def dump(self, dest_pattern="{id}.jpg", override=True, mask=False, alpha=False, bits=8, zoom=None, max_size=None, increase_area=None, contrast=None, gamma=None, colormap=None, inverse=None): """ Download the annotation crop, with optional image modifications. Parameters ---...
python
def dump(self, dest_pattern="{id}.jpg", override=True, mask=False, alpha=False, bits=8, zoom=None, max_size=None, increase_area=None, contrast=None, gamma=None, colormap=None, inverse=None): """ Download the annotation crop, with optional image modifications. Parameters ---...
[ "def", "dump", "(", "self", ",", "dest_pattern", "=", "\"{id}.jpg\"", ",", "override", "=", "True", ",", "mask", "=", "False", ",", "alpha", "=", "False", ",", "bits", "=", "8", ",", "zoom", "=", "None", ",", "max_size", "=", "None", ",", "increase_a...
Download the annotation crop, with optional image modifications. Parameters ---------- dest_pattern : str, optional Destination path for the downloaded image. "{X}" patterns are replaced by the value of X attribute if it exists. override : bool, optional ...
[ "Download", "the", "annotation", "crop", "with", "optional", "image", "modifications", "." ]
bac19722b900dd32c6cfd6bdb9354fc784d33bc4
https://github.com/cytomine/Cytomine-python-client/blob/bac19722b900dd32c6cfd6bdb9354fc784d33bc4/cytomine/models/annotation.py#L62-L144
48,177
galaxy-genome-annotation/python-apollo
arrow/commands/annotations/set_sequence.py
cli
def cli(ctx, organism, sequence): """Set the sequence for subsequent requests. Mostly used in client scripts to avoid passing the sequence and organism on every function call. Output: None """ return ctx.gi.annotations.set_sequence(organism, sequence)
python
def cli(ctx, organism, sequence): """Set the sequence for subsequent requests. Mostly used in client scripts to avoid passing the sequence and organism on every function call. Output: None """ return ctx.gi.annotations.set_sequence(organism, sequence)
[ "def", "cli", "(", "ctx", ",", "organism", ",", "sequence", ")", ":", "return", "ctx", ".", "gi", ".", "annotations", ".", "set_sequence", "(", "organism", ",", "sequence", ")" ]
Set the sequence for subsequent requests. Mostly used in client scripts to avoid passing the sequence and organism on every function call. Output: None
[ "Set", "the", "sequence", "for", "subsequent", "requests", ".", "Mostly", "used", "in", "client", "scripts", "to", "avoid", "passing", "the", "sequence", "and", "organism", "on", "every", "function", "call", "." ]
2bc9991302abe4402ec2885dcaac35915475b387
https://github.com/galaxy-genome-annotation/python-apollo/blob/2bc9991302abe4402ec2885dcaac35915475b387/arrow/commands/annotations/set_sequence.py#L12-L19
48,178
hearsaycorp/normalize
normalize/selector.py
MultiFieldSelector.path
def path(self): """The path attribute returns a stringified, concise representation of the MultiFieldSelector. It can be reversed by the ``from_path`` constructor. """ if len(self.heads) == 1: return _fmt_mfs_path(self.heads.keys()[0], self.heads.values()[0]) ...
python
def path(self): """The path attribute returns a stringified, concise representation of the MultiFieldSelector. It can be reversed by the ``from_path`` constructor. """ if len(self.heads) == 1: return _fmt_mfs_path(self.heads.keys()[0], self.heads.values()[0]) ...
[ "def", "path", "(", "self", ")", ":", "if", "len", "(", "self", ".", "heads", ")", "==", "1", ":", "return", "_fmt_mfs_path", "(", "self", ".", "heads", ".", "keys", "(", ")", "[", "0", "]", ",", "self", ".", "heads", ".", "values", "(", ")", ...
The path attribute returns a stringified, concise representation of the MultiFieldSelector. It can be reversed by the ``from_path`` constructor.
[ "The", "path", "attribute", "returns", "a", "stringified", "concise", "representation", "of", "the", "MultiFieldSelector", ".", "It", "can", "be", "reversed", "by", "the", "from_path", "constructor", "." ]
8b36522ddca6d41b434580bd848f3bdaa7a999c8
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/selector.py#L626-L636
48,179
hearsaycorp/normalize
normalize/selector.py
MultiFieldSelector.get
def get(self, obj): """Creates a copy of the passed object which only contains the parts which are pointed to by one of the FieldSelectors that were used to construct the MultiFieldSelector. Can be used to produce 'filtered' versions of objects. """ ctor = type(obj) ...
python
def get(self, obj): """Creates a copy of the passed object which only contains the parts which are pointed to by one of the FieldSelectors that were used to construct the MultiFieldSelector. Can be used to produce 'filtered' versions of objects. """ ctor = type(obj) ...
[ "def", "get", "(", "self", ",", "obj", ")", ":", "ctor", "=", "type", "(", "obj", ")", "if", "isinstance", "(", "obj", ",", "(", "list", ",", "ListCollection", ")", ")", ":", "if", "self", ".", "has_string", ":", "raise", "TypeError", "(", "\"Multi...
Creates a copy of the passed object which only contains the parts which are pointed to by one of the FieldSelectors that were used to construct the MultiFieldSelector. Can be used to produce 'filtered' versions of objects.
[ "Creates", "a", "copy", "of", "the", "passed", "object", "which", "only", "contains", "the", "parts", "which", "are", "pointed", "to", "by", "one", "of", "the", "FieldSelectors", "that", "were", "used", "to", "construct", "the", "MultiFieldSelector", ".", "C...
8b36522ddca6d41b434580bd848f3bdaa7a999c8
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/selector.py#L785-L835
48,180
hearsaycorp/normalize
normalize/selector.py
MultiFieldSelector.delete
def delete(self, obj, force=False): """Deletes all of the fields at the specified locations. args: ``obj=``\ *OBJECT* the object to remove the fields from ``force=``\ *BOOL* if True, missing attributes do not raise errors. Otherwise, ...
python
def delete(self, obj, force=False): """Deletes all of the fields at the specified locations. args: ``obj=``\ *OBJECT* the object to remove the fields from ``force=``\ *BOOL* if True, missing attributes do not raise errors. Otherwise, ...
[ "def", "delete", "(", "self", ",", "obj", ",", "force", "=", "False", ")", ":", "# TODO: this could be a whole lot more efficient!", "if", "not", "force", ":", "for", "fs", "in", "self", ":", "try", ":", "fs", ".", "get", "(", "obj", ")", "except", "Fiel...
Deletes all of the fields at the specified locations. args: ``obj=``\ *OBJECT* the object to remove the fields from ``force=``\ *BOOL* if True, missing attributes do not raise errors. Otherwise, the first failure raises an exception wit...
[ "Deletes", "all", "of", "the", "fields", "at", "the", "specified", "locations", "." ]
8b36522ddca6d41b434580bd848f3bdaa7a999c8
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/selector.py#L837-L862
48,181
merll/docker-fabric
dockerfabric/tasks.py
reset_socat
def reset_socat(use_sudo=False): """ Finds and closes all processes of `socat`. :param use_sudo: Use `sudo` command. As Docker-Fabric does not run `socat` with `sudo`, this is by default set to ``False``. Setting it to ``True`` could unintentionally remove instances from other users. :type use_su...
python
def reset_socat(use_sudo=False): """ Finds and closes all processes of `socat`. :param use_sudo: Use `sudo` command. As Docker-Fabric does not run `socat` with `sudo`, this is by default set to ``False``. Setting it to ``True`` could unintentionally remove instances from other users. :type use_su...
[ "def", "reset_socat", "(", "use_sudo", "=", "False", ")", ":", "output", "=", "stdout_result", "(", "'ps -o pid -C socat'", ",", "quiet", "=", "True", ")", "pids", "=", "output", ".", "split", "(", "'\\n'", ")", "[", "1", ":", "]", "puts", "(", "\"Remo...
Finds and closes all processes of `socat`. :param use_sudo: Use `sudo` command. As Docker-Fabric does not run `socat` with `sudo`, this is by default set to ``False``. Setting it to ``True`` could unintentionally remove instances from other users. :type use_sudo: bool
[ "Finds", "and", "closes", "all", "processes", "of", "socat", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L63-L75
48,182
merll/docker-fabric
dockerfabric/tasks.py
version
def version(): """ Shows version information of the remote Docker service, similar to ``docker version``. """ output = docker_fabric().version() col_len = max(map(len, output.keys())) + 1 puts('') for k, v in six.iteritems(output): fastprint('{0:{1}} {2}'.format(''.join((k, ':')), co...
python
def version(): """ Shows version information of the remote Docker service, similar to ``docker version``. """ output = docker_fabric().version() col_len = max(map(len, output.keys())) + 1 puts('') for k, v in six.iteritems(output): fastprint('{0:{1}} {2}'.format(''.join((k, ':')), co...
[ "def", "version", "(", ")", ":", "output", "=", "docker_fabric", "(", ")", ".", "version", "(", ")", "col_len", "=", "max", "(", "map", "(", "len", ",", "output", ".", "keys", "(", ")", ")", ")", "+", "1", "puts", "(", "''", ")", "for", "k", ...
Shows version information of the remote Docker service, similar to ``docker version``.
[ "Shows", "version", "information", "of", "the", "remote", "Docker", "service", "similar", "to", "docker", "version", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L79-L88
48,183
merll/docker-fabric
dockerfabric/tasks.py
list_images
def list_images(list_all=False, full_ids=False): """ Lists images on the Docker remote host, similar to ``docker images``. :param list_all: Lists all images (e.g. dependencies). Default is ``False``, only shows named images. :type list_all: bool :param full_ids: Shows the full ids. When ``False`` (...
python
def list_images(list_all=False, full_ids=False): """ Lists images on the Docker remote host, similar to ``docker images``. :param list_all: Lists all images (e.g. dependencies). Default is ``False``, only shows named images. :type list_all: bool :param full_ids: Shows the full ids. When ``False`` (...
[ "def", "list_images", "(", "list_all", "=", "False", ",", "full_ids", "=", "False", ")", ":", "images", "=", "docker_fabric", "(", ")", ".", "images", "(", "all", "=", "list_all", ")", "_format_output_table", "(", "images", ",", "IMAGE_COLUMNS", ",", "full...
Lists images on the Docker remote host, similar to ``docker images``. :param list_all: Lists all images (e.g. dependencies). Default is ``False``, only shows named images. :type list_all: bool :param full_ids: Shows the full ids. When ``False`` (default) only shows the first 12 characters. :type full_i...
[ "Lists", "images", "on", "the", "Docker", "remote", "host", "similar", "to", "docker", "images", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L116-L126
48,184
merll/docker-fabric
dockerfabric/tasks.py
list_containers
def list_containers(list_all=True, short_image=True, full_ids=False, full_cmd=False): """ Lists containers on the Docker remote host, similar to ``docker ps``. :param list_all: Shows all containers. Default is ``False``, which omits exited containers. :type list_all: bool :param short_image: Hides ...
python
def list_containers(list_all=True, short_image=True, full_ids=False, full_cmd=False): """ Lists containers on the Docker remote host, similar to ``docker ps``. :param list_all: Shows all containers. Default is ``False``, which omits exited containers. :type list_all: bool :param short_image: Hides ...
[ "def", "list_containers", "(", "list_all", "=", "True", ",", "short_image", "=", "True", ",", "full_ids", "=", "False", ",", "full_cmd", "=", "False", ")", ":", "containers", "=", "docker_fabric", "(", ")", ".", "containers", "(", "all", "=", "list_all", ...
Lists containers on the Docker remote host, similar to ``docker ps``. :param list_all: Shows all containers. Default is ``False``, which omits exited containers. :type list_all: bool :param short_image: Hides the repository prefix for preserving space. Default is ``True``. :type short_image: bool :...
[ "Lists", "containers", "on", "the", "Docker", "remote", "host", "similar", "to", "docker", "ps", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L130-L144
48,185
merll/docker-fabric
dockerfabric/tasks.py
list_networks
def list_networks(full_ids=False): """ Lists networks on the Docker remote host, similar to ``docker network ls``. :param full_ids: Shows the full network ids. When ``False`` (default) only shows the first 12 characters. :type full_ids: bool """ networks = docker_fabric().networks() _format...
python
def list_networks(full_ids=False): """ Lists networks on the Docker remote host, similar to ``docker network ls``. :param full_ids: Shows the full network ids. When ``False`` (default) only shows the first 12 characters. :type full_ids: bool """ networks = docker_fabric().networks() _format...
[ "def", "list_networks", "(", "full_ids", "=", "False", ")", ":", "networks", "=", "docker_fabric", "(", ")", ".", "networks", "(", ")", "_format_output_table", "(", "networks", ",", "NETWORK_COLUMNS", ",", "full_ids", ")" ]
Lists networks on the Docker remote host, similar to ``docker network ls``. :param full_ids: Shows the full network ids. When ``False`` (default) only shows the first 12 characters. :type full_ids: bool
[ "Lists", "networks", "on", "the", "Docker", "remote", "host", "similar", "to", "docker", "network", "ls", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L148-L156
48,186
merll/docker-fabric
dockerfabric/tasks.py
cleanup_containers
def cleanup_containers(**kwargs): """ Removes all containers that have finished running. Similar to the ``prune`` functionality in newer Docker versions. """ containers = docker_fabric().cleanup_containers(**kwargs) if kwargs.get('list_only'): puts('Existing containers:') for c_id, c...
python
def cleanup_containers(**kwargs): """ Removes all containers that have finished running. Similar to the ``prune`` functionality in newer Docker versions. """ containers = docker_fabric().cleanup_containers(**kwargs) if kwargs.get('list_only'): puts('Existing containers:') for c_id, c...
[ "def", "cleanup_containers", "(", "*", "*", "kwargs", ")", ":", "containers", "=", "docker_fabric", "(", ")", ".", "cleanup_containers", "(", "*", "*", "kwargs", ")", "if", "kwargs", ".", "get", "(", "'list_only'", ")", ":", "puts", "(", "'Existing contain...
Removes all containers that have finished running. Similar to the ``prune`` functionality in newer Docker versions.
[ "Removes", "all", "containers", "that", "have", "finished", "running", ".", "Similar", "to", "the", "prune", "functionality", "in", "newer", "Docker", "versions", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L169-L177
48,187
merll/docker-fabric
dockerfabric/tasks.py
cleanup_images
def cleanup_images(remove_old=False, **kwargs): """ Removes all images that have no name, and that are not references as dependency by any other named image. Similar to the ``prune`` functionality in newer Docker versions, but supports more filters. :param remove_old: Also remove images that do have a ...
python
def cleanup_images(remove_old=False, **kwargs): """ Removes all images that have no name, and that are not references as dependency by any other named image. Similar to the ``prune`` functionality in newer Docker versions, but supports more filters. :param remove_old: Also remove images that do have a ...
[ "def", "cleanup_images", "(", "remove_old", "=", "False", ",", "*", "*", "kwargs", ")", ":", "keep_tags", "=", "env", ".", "get", "(", "'docker_keep_tags'", ")", "if", "keep_tags", "is", "not", "None", ":", "kwargs", ".", "setdefault", "(", "'keep_tags'", ...
Removes all images that have no name, and that are not references as dependency by any other named image. Similar to the ``prune`` functionality in newer Docker versions, but supports more filters. :param remove_old: Also remove images that do have a name, but no `latest` tag. :type remove_old: bool
[ "Removes", "all", "images", "that", "have", "no", "name", "and", "that", "are", "not", "references", "as", "dependency", "by", "any", "other", "named", "image", ".", "Similar", "to", "the", "prune", "functionality", "in", "newer", "Docker", "versions", "but"...
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L181-L196
48,188
merll/docker-fabric
dockerfabric/tasks.py
save_image
def save_image(image, filename=None): """ Saves a Docker image from the remote to a local files. For performance reasons, uses the Docker command line client on the host, generates a gzip-tarball and downloads that. :param image: Image name or id. :type image: unicode :param filename: File name...
python
def save_image(image, filename=None): """ Saves a Docker image from the remote to a local files. For performance reasons, uses the Docker command line client on the host, generates a gzip-tarball and downloads that. :param image: Image name or id. :type image: unicode :param filename: File name...
[ "def", "save_image", "(", "image", ",", "filename", "=", "None", ")", ":", "local_name", "=", "filename", "or", "'{0}.tar.gz'", ".", "format", "(", "image", ")", "cli", ".", "save_image", "(", "image", ",", "local_name", ")" ]
Saves a Docker image from the remote to a local files. For performance reasons, uses the Docker command line client on the host, generates a gzip-tarball and downloads that. :param image: Image name or id. :type image: unicode :param filename: File name to store the local file. If not provided, will us...
[ "Saves", "a", "Docker", "image", "from", "the", "remote", "to", "a", "local", "files", ".", "For", "performance", "reasons", "uses", "the", "Docker", "command", "line", "client", "on", "the", "host", "generates", "a", "gzip", "-", "tarball", "and", "downlo...
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L214-L226
48,189
merll/docker-fabric
dockerfabric/tasks.py
load_image
def load_image(filename, timeout=120): """ Uploads an image from a local file to a Docker remote. Note that this temporarily has to extend the service timeout period. :param filename: Local file name. :type filename: unicode :param timeout: Timeout in seconds to set temporarily for the upload. ...
python
def load_image(filename, timeout=120): """ Uploads an image from a local file to a Docker remote. Note that this temporarily has to extend the service timeout period. :param filename: Local file name. :type filename: unicode :param timeout: Timeout in seconds to set temporarily for the upload. ...
[ "def", "load_image", "(", "filename", ",", "timeout", "=", "120", ")", ":", "c", "=", "docker_fabric", "(", ")", "with", "open", "(", "expand_path", "(", "filename", ")", ",", "'r'", ")", "as", "f", ":", "_timeout", "=", "c", ".", "_timeout", "c", ...
Uploads an image from a local file to a Docker remote. Note that this temporarily has to extend the service timeout period. :param filename: Local file name. :type filename: unicode :param timeout: Timeout in seconds to set temporarily for the upload. :type timeout: int
[ "Uploads", "an", "image", "from", "a", "local", "file", "to", "a", "Docker", "remote", ".", "Note", "that", "this", "temporarily", "has", "to", "extend", "the", "service", "timeout", "period", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/tasks.py#L230-L247
48,190
hearsaycorp/normalize
normalize/record/__init__.py
Record.diff_iter
def diff_iter(self, other, **kwargs): """Generator method which returns the differences from the invocant to the argument. args: ``other=``\ *Record*\ \|\ *Anything* The thing to compare against; the types must match, unless ``duck_type=True`` is p...
python
def diff_iter(self, other, **kwargs): """Generator method which returns the differences from the invocant to the argument. args: ``other=``\ *Record*\ \|\ *Anything* The thing to compare against; the types must match, unless ``duck_type=True`` is p...
[ "def", "diff_iter", "(", "self", ",", "other", ",", "*", "*", "kwargs", ")", ":", "from", "normalize", ".", "diff", "import", "diff_iter", "return", "diff_iter", "(", "self", ",", "other", ",", "*", "*", "kwargs", ")" ]
Generator method which returns the differences from the invocant to the argument. args: ``other=``\ *Record*\ \|\ *Anything* The thing to compare against; the types must match, unless ``duck_type=True`` is passed. *diff_option*\ =\ *value* ...
[ "Generator", "method", "which", "returns", "the", "differences", "from", "the", "invocant", "to", "the", "argument", "." ]
8b36522ddca6d41b434580bd848f3bdaa7a999c8
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/record/__init__.py#L153-L168
48,191
zhanglab/psamm
psamm/commands/primarypairs.py
_parse_weights
def _parse_weights(weight_args, default_weight=0.6): """Parse list of weight assignments.""" weights_dict = {} r_group_weight = default_weight for weight_arg in weight_args: for weight_assignment in weight_arg.split(','): if '=' not in weight_assignment: raise ValueEr...
python
def _parse_weights(weight_args, default_weight=0.6): """Parse list of weight assignments.""" weights_dict = {} r_group_weight = default_weight for weight_arg in weight_args: for weight_assignment in weight_arg.split(','): if '=' not in weight_assignment: raise ValueEr...
[ "def", "_parse_weights", "(", "weight_args", ",", "default_weight", "=", "0.6", ")", ":", "weights_dict", "=", "{", "}", "r_group_weight", "=", "default_weight", "for", "weight_arg", "in", "weight_args", ":", "for", "weight_assignment", "in", "weight_arg", ".", ...
Parse list of weight assignments.
[ "Parse", "list", "of", "weight", "assignments", "." ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/primarypairs.py#L215-L236
48,192
zhanglab/psamm
psamm/commands/primarypairs.py
PrimaryPairsCommand._combine_transfers
def _combine_transfers(self, result): """Combine multiple pair transfers into one.""" transfers = {} for reaction_id, c1, c2, form in result: key = reaction_id, c1, c2 combined_form = transfers.setdefault(key, Formula()) transfers[key] = combined_form | form ...
python
def _combine_transfers(self, result): """Combine multiple pair transfers into one.""" transfers = {} for reaction_id, c1, c2, form in result: key = reaction_id, c1, c2 combined_form = transfers.setdefault(key, Formula()) transfers[key] = combined_form | form ...
[ "def", "_combine_transfers", "(", "self", ",", "result", ")", ":", "transfers", "=", "{", "}", "for", "reaction_id", ",", "c1", ",", "c2", ",", "form", "in", "result", ":", "key", "=", "reaction_id", ",", "c1", ",", "c2", "combined_form", "=", "transfe...
Combine multiple pair transfers into one.
[ "Combine", "multiple", "pair", "transfers", "into", "one", "." ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/primarypairs.py#L162-L171
48,193
merll/docker-fabric
dockerfabric/cli.py
copy_resource
def copy_resource(container, resource, local_filename, contents_only=True): """ Copies a resource from a container to a compressed tarball and downloads it. :param container: Container name or id. :type container: unicode :param resource: Name of resource to copy. :type resource: unicode :p...
python
def copy_resource(container, resource, local_filename, contents_only=True): """ Copies a resource from a container to a compressed tarball and downloads it. :param container: Container name or id. :type container: unicode :param resource: Name of resource to copy. :type resource: unicode :p...
[ "def", "copy_resource", "(", "container", ",", "resource", ",", "local_filename", ",", "contents_only", "=", "True", ")", ":", "with", "temp_dir", "(", ")", "as", "remote_tmp", ":", "base_name", "=", "os", ".", "path", ".", "basename", "(", "resource", ")"...
Copies a resource from a container to a compressed tarball and downloads it. :param container: Container name or id. :type container: unicode :param resource: Name of resource to copy. :type resource: unicode :param local_filename: Path to store the tarball locally. :type local_filename: unicod...
[ "Copies", "a", "resource", "from", "a", "container", "to", "a", "compressed", "tarball", "and", "downloads", "it", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/cli.py#L290-L320
48,194
merll/docker-fabric
dockerfabric/cli.py
save_image
def save_image(image, local_filename): """ Saves a Docker image as a compressed tarball. This command line client method is a suitable alternative, if the Remove API method is too slow. :param image: Image id or tag. :type image: unicode :param local_filename: Local file name to store the image...
python
def save_image(image, local_filename): """ Saves a Docker image as a compressed tarball. This command line client method is a suitable alternative, if the Remove API method is too slow. :param image: Image id or tag. :type image: unicode :param local_filename: Local file name to store the image...
[ "def", "save_image", "(", "image", ",", "local_filename", ")", ":", "r_name", ",", "__", ",", "i_name", "=", "image", ".", "rpartition", "(", "'/'", ")", "i_name", ",", "__", ",", "__", "=", "i_name", ".", "partition", "(", "':'", ")", "with", "temp_...
Saves a Docker image as a compressed tarball. This command line client method is a suitable alternative, if the Remove API method is too slow. :param image: Image id or tag. :type image: unicode :param local_filename: Local file name to store the image into. If this is a directory, the image will be st...
[ "Saves", "a", "Docker", "image", "as", "a", "compressed", "tarball", ".", "This", "command", "line", "client", "method", "is", "a", "suitable", "alternative", "if", "the", "Remove", "API", "method", "is", "too", "slow", "." ]
785d84e40e17265b667d8b11a6e30d8e6b2bf8d4
https://github.com/merll/docker-fabric/blob/785d84e40e17265b667d8b11a6e30d8e6b2bf8d4/dockerfabric/cli.py#L410-L425
48,195
zhanglab/psamm
psamm/datasource/modelseed.py
decode_name
def decode_name(s): """Decode names in ModelSEED files""" # Some names contain XML-like entity codes return re.sub(r'&#(\d+);', lambda x: chr(int(x.group(1))), s)
python
def decode_name(s): """Decode names in ModelSEED files""" # Some names contain XML-like entity codes return re.sub(r'&#(\d+);', lambda x: chr(int(x.group(1))), s)
[ "def", "decode_name", "(", "s", ")", ":", "# Some names contain XML-like entity codes", "return", "re", ".", "sub", "(", "r'&#(\\d+);'", ",", "lambda", "x", ":", "chr", "(", "int", "(", "x", ".", "group", "(", "1", ")", ")", ")", ",", "s", ")" ]
Decode names in ModelSEED files
[ "Decode", "names", "in", "ModelSEED", "files" ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/datasource/modelseed.py#L31-L34
48,196
zhanglab/psamm
psamm/datasource/modelseed.py
parse_compound_file
def parse_compound_file(f, context=None): """Iterate over the compound entries in the given file""" f.readline() # Skip header for lineno, row in enumerate(csv.reader(f, delimiter='\t')): compound_id, names, formula = row[:3] names = (decode_name(name) for name in names.split(',<br>')) ...
python
def parse_compound_file(f, context=None): """Iterate over the compound entries in the given file""" f.readline() # Skip header for lineno, row in enumerate(csv.reader(f, delimiter='\t')): compound_id, names, formula = row[:3] names = (decode_name(name) for name in names.split(',<br>')) ...
[ "def", "parse_compound_file", "(", "f", ",", "context", "=", "None", ")", ":", "f", ".", "readline", "(", ")", "# Skip header", "for", "lineno", ",", "row", "in", "enumerate", "(", "csv", ".", "reader", "(", "f", ",", "delimiter", "=", "'\\t'", ")", ...
Iterate over the compound entries in the given file
[ "Iterate", "over", "the", "compound", "entries", "in", "the", "given", "file" ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/datasource/modelseed.py#L88-L111
48,197
zhanglab/psamm
psamm/commands/search.py
SearchCommand.init_parser
def init_parser(cls, parser): """Initialize argument parser""" subparsers = parser.add_subparsers(title='Search domain') # Compound subcommand parser_compound = subparsers.add_parser( 'compound', help='Search in compounds') parser_compound.set_defaults(which='compoun...
python
def init_parser(cls, parser): """Initialize argument parser""" subparsers = parser.add_subparsers(title='Search domain') # Compound subcommand parser_compound = subparsers.add_parser( 'compound', help='Search in compounds') parser_compound.set_defaults(which='compoun...
[ "def", "init_parser", "(", "cls", ",", "parser", ")", ":", "subparsers", "=", "parser", ".", "add_subparsers", "(", "title", "=", "'Search domain'", ")", "# Compound subcommand", "parser_compound", "=", "subparsers", ".", "add_parser", "(", "'compound'", ",", "h...
Initialize argument parser
[ "Initialize", "argument", "parser" ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/search.py#L36-L64
48,198
zhanglab/psamm
psamm/commands/search.py
SearchCommand.run
def run(self): """Run search command.""" which_command = self._args.which if which_command == 'compound': self._search_compound() elif which_command == 'reaction': self._search_reaction()
python
def run(self): """Run search command.""" which_command = self._args.which if which_command == 'compound': self._search_compound() elif which_command == 'reaction': self._search_reaction()
[ "def", "run", "(", "self", ")", ":", "which_command", "=", "self", ".", "_args", ".", "which", "if", "which_command", "==", "'compound'", ":", "self", ".", "_search_compound", "(", ")", "elif", "which_command", "==", "'reaction'", ":", "self", ".", "_searc...
Run search command.
[ "Run", "search", "command", "." ]
dc427848c4f9d109ca590f0afa024c63b685b3f4
https://github.com/zhanglab/psamm/blob/dc427848c4f9d109ca590f0afa024c63b685b3f4/psamm/commands/search.py#L66-L73
48,199
hearsaycorp/normalize
normalize/property/json.py
JsonProperty.to_json
def to_json(self, propval, extraneous=False, to_json_func=None): """This function calls the ``json_out`` function, if it was specified, otherwise continues with JSON conversion of the value in the slot by calling ``to_json_func`` on it. """ if self.json_out: return se...
python
def to_json(self, propval, extraneous=False, to_json_func=None): """This function calls the ``json_out`` function, if it was specified, otherwise continues with JSON conversion of the value in the slot by calling ``to_json_func`` on it. """ if self.json_out: return se...
[ "def", "to_json", "(", "self", ",", "propval", ",", "extraneous", "=", "False", ",", "to_json_func", "=", "None", ")", ":", "if", "self", ".", "json_out", ":", "return", "self", ".", "json_out", "(", "propval", ")", "else", ":", "if", "not", "to_json_f...
This function calls the ``json_out`` function, if it was specified, otherwise continues with JSON conversion of the value in the slot by calling ``to_json_func`` on it.
[ "This", "function", "calls", "the", "json_out", "function", "if", "it", "was", "specified", "otherwise", "continues", "with", "JSON", "conversion", "of", "the", "value", "in", "the", "slot", "by", "calling", "to_json_func", "on", "it", "." ]
8b36522ddca6d41b434580bd848f3bdaa7a999c8
https://github.com/hearsaycorp/normalize/blob/8b36522ddca6d41b434580bd848f3bdaa7a999c8/normalize/property/json.py#L78-L89