nwo
stringlengths
5
106
sha
stringlengths
40
40
path
stringlengths
4
174
language
stringclasses
1 value
identifier
stringlengths
1
140
parameters
stringlengths
0
87.7k
argument_list
stringclasses
1 value
return_statement
stringlengths
0
426k
docstring
stringlengths
0
64.3k
docstring_summary
stringlengths
0
26.3k
docstring_tokens
list
function
stringlengths
18
4.83M
function_tokens
list
url
stringlengths
83
304
RobertCsordas/RFCN-tensorflow
948f5fc79cfcb542ada593bb2ea4b86bb08d5e5c
Dataset/coco/pycocotools/coco.py
python
COCO.annToRLE
(self, ann)
return rle
Convert annotation which can be polygons, uncompressed RLE to RLE. :return: binary mask (numpy 2D array)
Convert annotation which can be polygons, uncompressed RLE to RLE. :return: binary mask (numpy 2D array)
[ "Convert", "annotation", "which", "can", "be", "polygons", "uncompressed", "RLE", "to", "RLE", ".", ":", "return", ":", "binary", "mask", "(", "numpy", "2D", "array", ")" ]
def annToRLE(self, ann): """ Convert annotation which can be polygons, uncompressed RLE to RLE. :return: binary mask (numpy 2D array) """ t = self.imgs[ann['image_id']] h, w = t['height'], t['width'] segm = ann['segmentation'] if type(segm) == list: ...
[ "def", "annToRLE", "(", "self", ",", "ann", ")", ":", "t", "=", "self", ".", "imgs", "[", "ann", "[", "'image_id'", "]", "]", "h", ",", "w", "=", "t", "[", "'height'", "]", ",", "t", "[", "'width'", "]", "segm", "=", "ann", "[", "'segmentation'...
https://github.com/RobertCsordas/RFCN-tensorflow/blob/948f5fc79cfcb542ada593bb2ea4b86bb08d5e5c/Dataset/coco/pycocotools/coco.py#L400-L419
BitconFeng/Deep-Feature-video
fff73fbcd0e21d5db566d2b63c644e18b2732551
lib/rpn/generate_anchor.py
python
_whctrs
(anchor)
return w, h, x_ctr, y_ctr
Return width, height, x center, and y center for an anchor (window).
Return width, height, x center, and y center for an anchor (window).
[ "Return", "width", "height", "x", "center", "and", "y", "center", "for", "an", "anchor", "(", "window", ")", "." ]
def _whctrs(anchor): """ Return width, height, x center, and y center for an anchor (window). """ w = anchor[2] - anchor[0] + 1 h = anchor[3] - anchor[1] + 1 x_ctr = anchor[0] + 0.5 * (w - 1) y_ctr = anchor[1] + 0.5 * (h - 1) return w, h, x_ctr, y_ctr
[ "def", "_whctrs", "(", "anchor", ")", ":", "w", "=", "anchor", "[", "2", "]", "-", "anchor", "[", "0", "]", "+", "1", "h", "=", "anchor", "[", "3", "]", "-", "anchor", "[", "1", "]", "+", "1", "x_ctr", "=", "anchor", "[", "0", "]", "+", "...
https://github.com/BitconFeng/Deep-Feature-video/blob/fff73fbcd0e21d5db566d2b63c644e18b2732551/lib/rpn/generate_anchor.py#L35-L44
owid/covid-19-data
936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92
scripts/src/cowidev/variants/etl.py
python
VariantsETL.pipe_dtypes
(self, df: pd.DataFrame)
return df
[]
def pipe_dtypes(self, df: pd.DataFrame) -> pd.DataFrame: df = df.astype({"num_sequences_total": "Int64", "num_sequences": "Int64"}) return df
[ "def", "pipe_dtypes", "(", "self", ",", "df", ":", "pd", ".", "DataFrame", ")", "->", "pd", ".", "DataFrame", ":", "df", "=", "df", ".", "astype", "(", "{", "\"num_sequences_total\"", ":", "\"Int64\"", ",", "\"num_sequences\"", ":", "\"Int64\"", "}", ")"...
https://github.com/owid/covid-19-data/blob/936aeae6cfbdc0163939ed7bd8ecdbb2582c0a92/scripts/src/cowidev/variants/etl.py#L236-L238
phonopy/phonopy
816586d0ba8177482ecf40e52f20cbdee2260d51
phonopy/qha/core.py
python
QHA.gibbs_temperature
(self)
return self._equiv_energies[: self._len]
Return Gibbs free energies at temperatures.
Return Gibbs free energies at temperatures.
[ "Return", "Gibbs", "free", "energies", "at", "temperatures", "." ]
def gibbs_temperature(self): """Return Gibbs free energies at temperatures.""" return self._equiv_energies[: self._len]
[ "def", "gibbs_temperature", "(", "self", ")", ":", "return", "self", ".", "_equiv_energies", "[", ":", "self", ".", "_len", "]" ]
https://github.com/phonopy/phonopy/blob/816586d0ba8177482ecf40e52f20cbdee2260d51/phonopy/qha/core.py#L271-L273
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/contrib/gdpopt/iterate.py
python
algorithm_should_terminate
(solve_data, config)
return False
Check if the algorithm should terminate. Termination conditions based on solver options and progress.
Check if the algorithm should terminate.
[ "Check", "if", "the", "algorithm", "should", "terminate", "." ]
def algorithm_should_terminate(solve_data, config): """Check if the algorithm should terminate. Termination conditions based on solver options and progress. """ # Check bound convergence if solve_data.LB + config.bound_tolerance >= solve_data.UB: config.logger.info( 'GDPopt exi...
[ "def", "algorithm_should_terminate", "(", "solve_data", ",", "config", ")", ":", "# Check bound convergence", "if", "solve_data", ".", "LB", "+", "config", ".", "bound_tolerance", ">=", "solve_data", ".", "UB", ":", "config", ".", "logger", ".", "info", "(", "...
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/gdpopt/iterate.py#L70-L122
opendatateam/udata
a295cab3c0e8f086fea1853655011f361ac81b77
tasks/__init__.py
python
i18nc
(ctx)
Compile translations
Compile translations
[ "Compile", "translations" ]
def i18nc(ctx): '''Compile translations''' header('Compiling translations') with ctx.cd(ROOT): ctx.run('python setup.py compile_catalog')
[ "def", "i18nc", "(", "ctx", ")", ":", "header", "(", "'Compiling translations'", ")", "with", "ctx", ".", "cd", "(", "ROOT", ")", ":", "ctx", ".", "run", "(", "'python setup.py compile_catalog'", ")" ]
https://github.com/opendatateam/udata/blob/a295cab3c0e8f086fea1853655011f361ac81b77/tasks/__init__.py#L206-L210
unknown-horizons/unknown-horizons
7397fb333006d26c3d9fe796c7bd9cb8c3b43a49
horizons/component/ambientsoundcomponent.py
python
AmbientSoundComponent.play_ambient
(self, soundfile, loop_interval=None, position=None, gain=10)
Starts playing an ambient sound. On looping, it will also play right now. Default: play sound once @param soundfile: path to audio file @param loop_interval: delay between two plays, None means no looping, 0 is no pause between looping @param position: Point @param gain: float, volume of the sound, default is...
Starts playing an ambient sound. On looping, it will also play right now. Default: play sound once
[ "Starts", "playing", "an", "ambient", "sound", ".", "On", "looping", "it", "will", "also", "play", "right", "now", ".", "Default", ":", "play", "sound", "once" ]
def play_ambient(self, soundfile, loop_interval=None, position=None, gain=10): """Starts playing an ambient sound. On looping, it will also play right now. Default: play sound once @param soundfile: path to audio file @param loop_interval: delay between two plays, None means no looping, 0 is no pause between lo...
[ "def", "play_ambient", "(", "self", ",", "soundfile", ",", "loop_interval", "=", "None", ",", "position", "=", "None", ",", "gain", "=", "10", ")", ":", "if", "horizons", ".", "globals", ".", "fife", ".", "get_fife_setting", "(", "\"PlaySounds\"", ")", "...
https://github.com/unknown-horizons/unknown-horizons/blob/7397fb333006d26c3d9fe796c7bd9cb8c3b43a49/horizons/component/ambientsoundcomponent.py#L81-L109
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit /tools/inject/plugins/generic/takeover.py
python
Takeover.osBof
(self)
[]
def osBof(self): if not isStackingAvailable() and not conf.direct: return if not Backend.isDbms(DBMS.MSSQL) or not Backend.isVersionWithin(("2000", "2005")): errMsg = "the back-end DBMS must be Microsoft SQL Server " errMsg += "2000 or 2005 to be able to exploit the ...
[ "def", "osBof", "(", "self", ")", ":", "if", "not", "isStackingAvailable", "(", ")", "and", "not", "conf", ".", "direct", ":", "return", "if", "not", "Backend", ".", "isDbms", "(", "DBMS", ".", "MSSQL", ")", "or", "not", "Backend", ".", "isVersionWithi...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit /tools/inject/plugins/generic/takeover.py#L321-L347
TileStache/TileStache
e96532bf59bf79c9991dcc06628f28b27bb19c08
TileStache/MBTiles.py
python
delete_tile
(filename, coord)
Delete a tile by coordinate.
Delete a tile by coordinate.
[ "Delete", "a", "tile", "by", "coordinate", "." ]
def delete_tile(filename, coord): """ Delete a tile by coordinate. """ db = _connect(filename) db.text_factory = bytes tile_row = (2**coord.zoom - 1) - coord.row # Hello, Paul Ramsey. q = 'DELETE FROM tiles WHERE zoom_level=? AND tile_column=? AND tile_row=?' db.execute(q, (coord.zoom, coor...
[ "def", "delete_tile", "(", "filename", ",", "coord", ")", ":", "db", "=", "_connect", "(", "filename", ")", "db", ".", "text_factory", "=", "bytes", "tile_row", "=", "(", "2", "**", "coord", ".", "zoom", "-", "1", ")", "-", "coord", ".", "row", "# ...
https://github.com/TileStache/TileStache/blob/e96532bf59bf79c9991dcc06628f28b27bb19c08/TileStache/MBTiles.py#L176-L184
geometalab/Vector-Tiles-Reader-QGIS-Plugin
a31ae86959c8f3b7d6f332f84191cd7ca4683e1d
ext-libs/google/protobuf/descriptor_pool.py
python
DescriptorPool.FindAllExtensions
(self, message_descriptor)
return list(self._extensions_by_number[message_descriptor].values())
Gets all the known extension of a given message. Extensions have to be registered to this pool by calling AddExtensionDescriptor. Args: message_descriptor: descriptor of the extended message. Returns: A list of FieldDescriptor describing the extensions.
Gets all the known extension of a given message.
[ "Gets", "all", "the", "known", "extension", "of", "a", "given", "message", "." ]
def FindAllExtensions(self, message_descriptor): """Gets all the known extension of a given message. Extensions have to be registered to this pool by calling AddExtensionDescriptor. Args: message_descriptor: descriptor of the extended message. Returns: A list of FieldDescriptor descri...
[ "def", "FindAllExtensions", "(", "self", ",", "message_descriptor", ")", ":", "return", "list", "(", "self", ".", "_extensions_by_number", "[", "message_descriptor", "]", ".", "values", "(", ")", ")" ]
https://github.com/geometalab/Vector-Tiles-Reader-QGIS-Plugin/blob/a31ae86959c8f3b7d6f332f84191cd7ca4683e1d/ext-libs/google/protobuf/descriptor_pool.py#L399-L411
pulp/pulp
a0a28d804f997b6f81c391378aff2e4c90183df9
bindings/pulp/bindings/search.py
python
SearchAPI.compose_filters
(cls, **kwargs)
Parse all of the arguments supplied on the command line, generating a spec suitable for passing to mongo. :param kwargs: all arguments passed on the command line as provided by okaara. :return: dict that is a mongo spec :rtype: dict
Parse all of the arguments supplied on the command line, generating a spec suitable for passing to mongo.
[ "Parse", "all", "of", "the", "arguments", "supplied", "on", "the", "command", "line", "generating", "a", "spec", "suitable", "for", "passing", "to", "mongo", "." ]
def compose_filters(cls, **kwargs): """ Parse all of the arguments supplied on the command line, generating a spec suitable for passing to mongo. :param kwargs: all arguments passed on the command line as provided by okaara. :return: dict that is a m...
[ "def", "compose_filters", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "# 'filters' overrides anything else that was supplied.", "if", "kwargs", ".", "get", "(", "'filters'", ",", "None", ")", ":", "return", "kwargs", "[", "'filters'", "]", "clauses", "=", "...
https://github.com/pulp/pulp/blob/a0a28d804f997b6f81c391378aff2e4c90183df9/bindings/pulp/bindings/search.py#L104-L131
openstack/python-neutronclient
517bef2c5454dde2eba5cc2194ee857be6be7164
neutronclient/v2_0/client.py
python
Client.update_bgp_speaker
(self, bgp_speaker_id, body=None)
return self.put(self.bgp_speaker_path % bgp_speaker_id, body=body)
Update a BGP speaker.
Update a BGP speaker.
[ "Update", "a", "BGP", "speaker", "." ]
def update_bgp_speaker(self, bgp_speaker_id, body=None): """Update a BGP speaker.""" return self.put(self.bgp_speaker_path % bgp_speaker_id, body=body)
[ "def", "update_bgp_speaker", "(", "self", ",", "bgp_speaker_id", ",", "body", "=", "None", ")", ":", "return", "self", ".", "put", "(", "self", ".", "bgp_speaker_path", "%", "bgp_speaker_id", ",", "body", "=", "body", ")" ]
https://github.com/openstack/python-neutronclient/blob/517bef2c5454dde2eba5cc2194ee857be6be7164/neutronclient/v2_0/client.py#L2148-L2150
leostat/rtfm
02f64322f612d087f659f6d32d159f04fcfddf53
rtfm.py
python
dbInsertTags
(conn, tags, cmdid)
[]
def dbInsertTags(conn, tags, cmdid): cur = conn.cursor() for tag in tags: debug("S : SELECT tagid from tbltagcontent where tag like '"+tag+"'") cur.execute("SELECT Tagid FROM Tbltagcontent where tag like ?", (tag, )) count = cur.fetchall() if len(count) > 1: err("More than one tag returned! "+str(count)) ...
[ "def", "dbInsertTags", "(", "conn", ",", "tags", ",", "cmdid", ")", ":", "cur", "=", "conn", ".", "cursor", "(", ")", "for", "tag", "in", "tags", ":", "debug", "(", "\"S : SELECT tagid from tbltagcontent where tag like '\"", "+", "tag", "+", "\"'\"", ")", ...
https://github.com/leostat/rtfm/blob/02f64322f612d087f659f6d32d159f04fcfddf53/rtfm.py#L323-L347
home-assistant/supervisor
69c2517d5211b483fdfe968b0a2b36b672ee7ab2
supervisor/api/__init__.py
python
RestAPI._register_homeassistant
(self)
Register Home Assistant functions.
Register Home Assistant functions.
[ "Register", "Home", "Assistant", "functions", "." ]
def _register_homeassistant(self) -> None: """Register Home Assistant functions.""" api_hass = APIHomeAssistant() api_hass.coresys = self.coresys self.webapp.add_routes( [ web.get("/core/info", api_hass.info), web.get("/core/logs", api_hass.lo...
[ "def", "_register_homeassistant", "(", "self", ")", "->", "None", ":", "api_hass", "=", "APIHomeAssistant", "(", ")", "api_hass", ".", "coresys", "=", "self", ".", "coresys", "self", ".", "webapp", ".", "add_routes", "(", "[", "web", ".", "get", "(", "\"...
https://github.com/home-assistant/supervisor/blob/69c2517d5211b483fdfe968b0a2b36b672ee7ab2/supervisor/api/__init__.py#L302-L331
automl/SMAC3
d4cb7ed76e0fbdd9edf6ab5360ff75de67ac2195
smac/utils/io/cmd_reader.py
python
truthy
(x: typing.Any)
Convert x into its truth value
Convert x into its truth value
[ "Convert", "x", "into", "its", "truth", "value" ]
def truthy(x: typing.Any) -> bool: """Convert x into its truth value""" if isinstance(x, bool): return x elif isinstance(x, (int, float)): return x != 0 elif isinstance(x, str): return bool(distutils.util.strtobool(x)) else: return False
[ "def", "truthy", "(", "x", ":", "typing", ".", "Any", ")", "->", "bool", ":", "if", "isinstance", "(", "x", ",", "bool", ")", ":", "return", "x", "elif", "isinstance", "(", "x", ",", "(", "int", ",", "float", ")", ")", ":", "return", "x", "!=",...
https://github.com/automl/SMAC3/blob/d4cb7ed76e0fbdd9edf6ab5360ff75de67ac2195/smac/utils/io/cmd_reader.py#L40-L49
conda/conda
09cb6bdde68e551852c3844fd2b59c8ba4cafce2
conda_env/specs/binstar.py
python
BinstarSpec.parse
(self)
return self.name.split('/', 1)
Parse environment definition handle
Parse environment definition handle
[ "Parse", "environment", "definition", "handle" ]
def parse(self): """Parse environment definition handle""" return self.name.split('/', 1)
[ "def", "parse", "(", "self", ")", ":", "return", "self", ".", "name", ".", "split", "(", "'/'", ",", "1", ")" ]
https://github.com/conda/conda/blob/09cb6bdde68e551852c3844fd2b59c8ba4cafce2/conda_env/specs/binstar.py#L136-L138
srusskih/SublimeJEDI
8a5054f0a053c8a8170c06c56216245240551d54
dependencies/jedi/inference/value/dynamic_arrays.py
python
check_array_additions
(context, sequence)
return _internal_check_array_additions(context, sequence)
Just a mapper function for the internal _internal_check_array_additions
Just a mapper function for the internal _internal_check_array_additions
[ "Just", "a", "mapper", "function", "for", "the", "internal", "_internal_check_array_additions" ]
def check_array_additions(context, sequence): """ Just a mapper function for the internal _internal_check_array_additions """ if sequence.array_type not in ('list', 'set'): # TODO also check for dict updates return NO_VALUES return _internal_check_array_additions(context, sequence)
[ "def", "check_array_additions", "(", "context", ",", "sequence", ")", ":", "if", "sequence", ".", "array_type", "not", "in", "(", "'list'", ",", "'set'", ")", ":", "# TODO also check for dict updates", "return", "NO_VALUES", "return", "_internal_check_array_additions"...
https://github.com/srusskih/SublimeJEDI/blob/8a5054f0a053c8a8170c06c56216245240551d54/dependencies/jedi/inference/value/dynamic_arrays.py#L34-L40
Blizzard/s2protocol
4bfe857bb832eee12cc6307dd699e3b74bd7e1b2
s2protocol/versions/protocol24944.py
python
decode_replay_game_events
(contents)
Decodes and yields each game event from the contents byte string.
Decodes and yields each game event from the contents byte string.
[ "Decodes", "and", "yields", "each", "game", "event", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_game_events(contents): """Decodes and yields each game event from the contents byte string.""" decoder = BitPackedDecoder(contents, typeinfos) for event in _decode_event_stream(decoder, game_eventid_typeid, game_ev...
[ "def", "decode_replay_game_events", "(", "contents", ")", ":", "decoder", "=", "BitPackedDecoder", "(", "contents", ",", "typeinfos", ")", "for", "event", "in", "_decode_event_stream", "(", "decoder", ",", "game_eventid_typeid", ",", "game_event_types", ",", "decode...
https://github.com/Blizzard/s2protocol/blob/4bfe857bb832eee12cc6307dd699e3b74bd7e1b2/s2protocol/versions/protocol24944.py#L368-L375
pm4py/pm4py-core
7807b09a088b02199cd0149d724d0e28793971bf
pm4py/algo/simulation/montecarlo/variants/petri_semaph_fifo.py
python
apply
(log: EventLog, net: PetriNet, im: Marking, fm: Marking, parameters: Optional[Dict[Union[str, Parameters], Any]] = None)
return log, {Outputs.OUTPUT_PLACES_INTERVAL_TREES.value: places_interval_trees, Outputs.OUTPUT_TRANSITIONS_INTERVAL_TREES.value: transitions_interval_trees, Outputs.OUTPUT_CASES_EX_TIME.value: cases_ex_time, Outputs.OUTPUT_MEDIAN_CASES_EX_TIME.value: median(cases_ex_ti...
Performs a Monte Carlo simulation of an accepting Petri net without duplicate transitions and where the preset is always distinct from the postset (FIFO variant; the semaphores pile up if waiting is needed, and the first in is the first to win the semaphore) Parameters ------------- log Eve...
Performs a Monte Carlo simulation of an accepting Petri net without duplicate transitions and where the preset is always distinct from the postset (FIFO variant; the semaphores pile up if waiting is needed, and the first in is the first to win the semaphore)
[ "Performs", "a", "Monte", "Carlo", "simulation", "of", "an", "accepting", "Petri", "net", "without", "duplicate", "transitions", "and", "where", "the", "preset", "is", "always", "distinct", "from", "the", "postset", "(", "FIFO", "variant", ";", "the", "semapho...
def apply(log: EventLog, net: PetriNet, im: Marking, fm: Marking, parameters: Optional[Dict[Union[str, Parameters], Any]] = None) -> Tuple[EventLog, Dict[str, Any]]: """ Performs a Monte Carlo simulation of an accepting Petri net without duplicate transitions and where the preset is always distinct from the...
[ "def", "apply", "(", "log", ":", "EventLog", ",", "net", ":", "PetriNet", ",", "im", ":", "Marking", ",", "fm", ":", "Marking", ",", "parameters", ":", "Optional", "[", "Dict", "[", "Union", "[", "str", ",", "Parameters", "]", ",", "Any", "]", "]",...
https://github.com/pm4py/pm4py-core/blob/7807b09a088b02199cd0149d724d0e28793971bf/pm4py/algo/simulation/montecarlo/variants/petri_semaph_fifo.py#L285-L440
deepgully/me
f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0
libs/sqlalchemy/sql/compiler.py
python
Compiled.scalar
(self, *multiparams, **params)
return self.execute(*multiparams, **params).scalar()
Execute this compiled object and return the result's scalar value.
Execute this compiled object and return the result's scalar value.
[ "Execute", "this", "compiled", "object", "and", "return", "the", "result", "s", "scalar", "value", "." ]
def scalar(self, *multiparams, **params): """Execute this compiled object and return the result's scalar value.""" return self.execute(*multiparams, **params).scalar()
[ "def", "scalar", "(", "self", ",", "*", "multiparams", ",", "*", "*", "params", ")", ":", "return", "self", ".", "execute", "(", "*", "multiparams", ",", "*", "*", "params", ")", ".", "scalar", "(", ")" ]
https://github.com/deepgully/me/blob/f7ad65edc2fe435310c6676bc2e322cfe5d4c8f0/libs/sqlalchemy/sql/compiler.py#L252-L256
rhinstaller/anaconda
63edc8680f1b05cbfe11bef28703acba808c5174
pyanaconda/modules/payloads/source/utils.py
python
is_valid_install_disk
(tree_dir)
return False
Is the disk a valid installation repository? Success criteria: - Disk must be already mounted at tree_dir. - A .discinfo file exists. - Third line of .discinfo equals current architecture. :param str tree_dir: Where the disk is mounted. :rtype: bool
Is the disk a valid installation repository?
[ "Is", "the", "disk", "a", "valid", "installation", "repository?" ]
def is_valid_install_disk(tree_dir): """Is the disk a valid installation repository? Success criteria: - Disk must be already mounted at tree_dir. - A .discinfo file exists. - Third line of .discinfo equals current architecture. :param str tree_dir: Where the disk is mounted. :rtype: bool ...
[ "def", "is_valid_install_disk", "(", "tree_dir", ")", ":", "try", ":", "with", "open", "(", "join_paths", "(", "tree_dir", ",", "\".discinfo\"", ")", ",", "\"r\"", ")", "as", "f", ":", "f", ".", "readline", "(", ")", "# throw away timestamp", "f", ".", "...
https://github.com/rhinstaller/anaconda/blob/63edc8680f1b05cbfe11bef28703acba808c5174/pyanaconda/modules/payloads/source/utils.py#L58-L78
IntelPython/sdc
1ebf55c00ef38dfbd401a70b3945e352a5a38b87
sdc/io/np_io.py
python
get_file_size
(fname)
return 0
[]
def get_file_size(fname): return 0
[ "def", "get_file_size", "(", "fname", ")", ":", "return", "0" ]
https://github.com/IntelPython/sdc/blob/1ebf55c00ef38dfbd401a70b3945e352a5a38b87/sdc/io/np_io.py#L174-L175
nose-devs/nose2
e0dc345da06995fdf00abeb3ed4ae65050d552bd
nose2/util.py
python
ispackage
(path)
return False
Is this path a package directory?
Is this path a package directory?
[ "Is", "this", "path", "a", "package", "directory?" ]
def ispackage(path): """Is this path a package directory?""" if os.path.isdir(path): # at least the end of the path must be a legal python identifier # and __init__.py[co] must exist end = os.path.basename(path) if IDENT_RE.match(end): for init in ("__init__.py", "__i...
[ "def", "ispackage", "(", "path", ")", ":", "if", "os", ".", "path", ".", "isdir", "(", "path", ")", ":", "# at least the end of the path must be a legal python identifier", "# and __init__.py[co] must exist", "end", "=", "os", ".", "path", ".", "basename", "(", "p...
https://github.com/nose-devs/nose2/blob/e0dc345da06995fdf00abeb3ed4ae65050d552bd/nose2/util.py#L203-L217
ring04h/wyportmap
c4201e2313504e780a7f25238eba2a2d3223e739
libnmap/objects/host.py
python
NmapHost.get_dict
(self)
return d
Return a dict representation of the object. This is needed by NmapDiff to allow comparaison :return dict
Return a dict representation of the object.
[ "Return", "a", "dict", "representation", "of", "the", "object", "." ]
def get_dict(self): """ Return a dict representation of the object. This is needed by NmapDiff to allow comparaison :return dict """ d = dict([("{0}::{1}".format(s.__class__.__name__, str(s.id)), hash(s)) for s in self.ser...
[ "def", "get_dict", "(", "self", ")", ":", "d", "=", "dict", "(", "[", "(", "\"{0}::{1}\"", ".", "format", "(", "s", ".", "__class__", ".", "__name__", ",", "str", "(", "s", ".", "id", ")", ")", ",", "hash", "(", "s", ")", ")", "for", "s", "in...
https://github.com/ring04h/wyportmap/blob/c4201e2313504e780a7f25238eba2a2d3223e739/libnmap/objects/host.py#L480-L494
jaberg/skdata
fb08e82cdd4fc080bd619ab5acdb0d82aee30787
skdata/mnist/dataset.py
python
read
(f, debug=False)
return np.fromstring(data, dtype='uint8').reshape(shape)
Load all or part of file 'f' into a numpy ndarray :param f: file from which to read :type f: file-like object. Can be a gzip open file.
Load all or part of file 'f' into a numpy ndarray
[ "Load", "all", "or", "part", "of", "file", "f", "into", "a", "numpy", "ndarray" ]
def read(f, debug=False): """Load all or part of file 'f' into a numpy ndarray :param f: file from which to read :type f: file-like object. Can be a gzip open file. """ shape = _read_header(f, debug) data = f.read(np.prod(shape)) return np.fromstring(data, dtype='uint8').reshape(shape)
[ "def", "read", "(", "f", ",", "debug", "=", "False", ")", ":", "shape", "=", "_read_header", "(", "f", ",", "debug", ")", "data", "=", "f", ".", "read", "(", "np", ".", "prod", "(", "shape", ")", ")", "return", "np", ".", "fromstring", "(", "da...
https://github.com/jaberg/skdata/blob/fb08e82cdd4fc080bd619ab5acdb0d82aee30787/skdata/mnist/dataset.py#L110-L119
lohriialo/photoshop-scripting-python
6b97da967a5d0a45e54f7c99631b29773b923f09
api_reference/photoshop_2020.py
python
ColorSamplers.Item
(self, ItemKey=defaultNamedNotOptArg)
return ret
get an element from the collection
get an element from the collection
[ "get", "an", "element", "from", "the", "collection" ]
def Item(self, ItemKey=defaultNamedNotOptArg): 'get an element from the collection' ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey ) if ret is not None: ret = Dispatch(ret, u'Item', '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') return ret
[ "def", "Item", "(", "self", ",", "ItemKey", "=", "defaultNamedNotOptArg", ")", ":", "ret", "=", "self", ".", "_oleobj_", ".", "InvokeTypes", "(", "0", ",", "LCID", ",", "2", ",", "(", "9", ",", "0", ")", ",", "(", "(", "12", ",", "1", ")", ",",...
https://github.com/lohriialo/photoshop-scripting-python/blob/6b97da967a5d0a45e54f7c99631b29773b923f09/api_reference/photoshop_2020.py#L1424-L1430
jacoxu/encoder_decoder
6829c3bc42105aedfd1b8a81c81be19df4326c0a
keras/backend/theano_backend.py
python
any
(x, axis=None, keepdims=False)
return T.any(x, axis=axis, keepdims=keepdims)
Bitwise reduction (logical OR).
Bitwise reduction (logical OR).
[ "Bitwise", "reduction", "(", "logical", "OR", ")", "." ]
def any(x, axis=None, keepdims=False): '''Bitwise reduction (logical OR). ''' return T.any(x, axis=axis, keepdims=keepdims)
[ "def", "any", "(", "x", ",", "axis", "=", "None", ",", "keepdims", "=", "False", ")", ":", "return", "T", ".", "any", "(", "x", ",", "axis", "=", "axis", ",", "keepdims", "=", "keepdims", ")" ]
https://github.com/jacoxu/encoder_decoder/blob/6829c3bc42105aedfd1b8a81c81be19df4326c0a/keras/backend/theano_backend.py#L153-L156
openstack/neutron
fb229fb527ac8b95526412f7762d90826ac41428
neutron/cmd/ovn/migration_mtu.py
python
get_connection
()
return conn
Get OpenStack SDK Connection object with parameters from environment. Project scoped authorization is used and the following environment variables are required: OS_AUTH_URL URL to OpenStack Identity service OS_PROJECT_NAME Name of project for authorization OS_USERNAME Username ...
Get OpenStack SDK Connection object with parameters from environment.
[ "Get", "OpenStack", "SDK", "Connection", "object", "with", "parameters", "from", "environment", "." ]
def get_connection(): """Get OpenStack SDK Connection object with parameters from environment. Project scoped authorization is used and the following environment variables are required: OS_AUTH_URL URL to OpenStack Identity service OS_PROJECT_NAME Name of project for authorization ...
[ "def", "get_connection", "(", ")", ":", "user_domain_name", "=", "os", ".", "environ", ".", "get", "(", "'OS_USER_DOMAIN_NAME'", ")", "project_domain_name", "=", "os", ".", "environ", ".", "get", "(", "'OS_PROJECT_DOMAIN_NAME'", ")", "user_domain_id", "=", "os",...
https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/cmd/ovn/migration_mtu.py#L33-L77
PINTO0309/PINTO_model_zoo
2924acda7a7d541d8712efd7cc4fd1c61ef5bddd
059_yolov5/22_yolov5s_new/yolov5_tflite_inference.py
python
yolov5_tflite.compute_iou
(self,box, boxes, box_area, boxes_area)
return ious
[]
def compute_iou(self,box, boxes, box_area, boxes_area): # this is the iou of the box against all other boxes assert boxes.shape[0] == boxes_area.shape[0] # get all the origin-ys # push up all the lower origin-xs, while keeping the higher origin-xs ys1 = np.maximum(box[0], boxes[:...
[ "def", "compute_iou", "(", "self", ",", "box", ",", "boxes", ",", "box_area", ",", "boxes_area", ")", ":", "# this is the iou of the box against all other boxes", "assert", "boxes", ".", "shape", "[", "0", "]", "==", "boxes_area", ".", "shape", "[", "0", "]", ...
https://github.com/PINTO0309/PINTO_model_zoo/blob/2924acda7a7d541d8712efd7cc4fd1c61ef5bddd/059_yolov5/22_yolov5s_new/yolov5_tflite_inference.py#L59-L87
AppScale/gts
46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9
AdminServer/appscale/admin/instance_manager/projects_manager.py
python
Version.ensure_watch
(self)
Restarts the watch if it has been cancelled.
Restarts the watch if it has been cancelled.
[ "Restarts", "the", "watch", "if", "it", "has", "been", "cancelled", "." ]
def ensure_watch(self): """ Restarts the watch if it has been cancelled. """ if self._stopped: self._stopped = False self.watch = self._zk_client.DataWatch(self.version_node, self._update_version_watch)
[ "def", "ensure_watch", "(", "self", ")", ":", "if", "self", ".", "_stopped", ":", "self", ".", "_stopped", "=", "False", "self", ".", "watch", "=", "self", ".", "_zk_client", ".", "DataWatch", "(", "self", ".", "version_node", ",", "self", ".", "_updat...
https://github.com/AppScale/gts/blob/46f909cf5dc5ba81faf9d81dc9af598dcf8a82a9/AdminServer/appscale/admin/instance_manager/projects_manager.py#L146-L151
kpreid/shinysdr
25022d36903ff67e036e82a22b6555a12a4d8e8a
shinysdr/i/audiomux.py
python
BusPlumber.connect
(self, inputs, outputs)
Make all new connections (graph.disconnect_all() must have been done) between inputs and outputs. inputs and outputs must be iterables of (sample_rate, block) tuples.
Make all new connections (graph.disconnect_all() must have been done) between inputs and outputs. inputs and outputs must be iterables of (sample_rate, block) tuples.
[ "Make", "all", "new", "connections", "(", "graph", ".", "disconnect_all", "()", "must", "have", "been", "done", ")", "between", "inputs", "and", "outputs", ".", "inputs", "and", "outputs", "must", "be", "iterables", "of", "(", "sample_rate", "block", ")", ...
def connect(self, inputs, outputs): """ Make all new connections (graph.disconnect_all() must have been done) between inputs and outputs. inputs and outputs must be iterables of (sample_rate, block) tuples. """ inputs = list(inputs) outputs = list(outputs) ...
[ "def", "connect", "(", "self", ",", "inputs", ",", "outputs", ")", ":", "inputs", "=", "list", "(", "inputs", ")", "outputs", "=", "list", "(", "outputs", ")", "# Determine bus rate.", "# The bus obviously does not need to be higher than the rate of any bus input, becau...
https://github.com/kpreid/shinysdr/blob/25022d36903ff67e036e82a22b6555a12a4d8e8a/shinysdr/i/audiomux.py#L180-L220
Azure/azure-cli
6c1b085a0910c6c2139006fcbd8ade44006eb6dd
src/azure-cli-core/azure/cli/core/style.py
python
print_styled_text
(*styled_text_objects, file=None, **kwargs)
Print styled text. This function wraps the built-in function `print`, additional arguments can be sent via keyword arguments. :param styled_text_objects: The input text objects. See format_styled_text for formats of each object. :param file: The file to print the styled text. The default target is sys.stde...
Print styled text. This function wraps the built-in function `print`, additional arguments can be sent via keyword arguments.
[ "Print", "styled", "text", ".", "This", "function", "wraps", "the", "built", "-", "in", "function", "print", "additional", "arguments", "can", "be", "sent", "via", "keyword", "arguments", "." ]
def print_styled_text(*styled_text_objects, file=None, **kwargs): """ Print styled text. This function wraps the built-in function `print`, additional arguments can be sent via keyword arguments. :param styled_text_objects: The input text objects. See format_styled_text for formats of each object. ...
[ "def", "print_styled_text", "(", "*", "styled_text_objects", ",", "file", "=", "None", ",", "*", "*", "kwargs", ")", ":", "formatted_list", "=", "[", "format_styled_text", "(", "obj", ")", "for", "obj", "in", "styled_text_objects", "]", "# Always fetch the lates...
https://github.com/Azure/azure-cli/blob/6c1b085a0910c6c2139006fcbd8ade44006eb6dd/src/azure-cli-core/azure/cli/core/style.py#L123-L133
bpython/curtsies
56a0ad1199d346a059635982aa87ca07be17e14a
curtsies/termformatconstants.py
python
seq
(num: int)
return f"[{num}m"
[]
def seq(num: int) -> str: return f"[{num}m"
[ "def", "seq", "(", "num", ":", "int", ")", "->", "str", ":", "return", "f\"\u001b[{num}m\"" ]
https://github.com/bpython/curtsies/blob/56a0ad1199d346a059635982aa87ca07be17e14a/curtsies/termformatconstants.py#L19-L20
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/morestats.py
python
mvsdist
(data)
return mdist, vdist, sdist
'Frozen' distributions for mean, variance, and standard deviation of data. Parameters ---------- data : array_like Input array. Converted to 1-D using ravel. Requires 2 or more data-points. Returns ------- mdist : "frozen" distribution object Distribution object represe...
'Frozen' distributions for mean, variance, and standard deviation of data.
[ "Frozen", "distributions", "for", "mean", "variance", "and", "standard", "deviation", "of", "data", "." ]
def mvsdist(data): """ 'Frozen' distributions for mean, variance, and standard deviation of data. Parameters ---------- data : array_like Input array. Converted to 1-D using ravel. Requires 2 or more data-points. Returns ------- mdist : "frozen" distribution object ...
[ "def", "mvsdist", "(", "data", ")", ":", "x", "=", "ravel", "(", "data", ")", "n", "=", "len", "(", "x", ")", "if", "n", "<", "2", ":", "raise", "ValueError", "(", "\"Need at least 2 data-points.\"", ")", "xbar", "=", "x", ".", "mean", "(", ")", ...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/dist/coffeegrindsize.app/Contents/Resources/lib/python3.7/scipy/stats/morestats.py#L139-L211
Scarygami/mirror-api
497783f6d721b24b793c1fcd8c71d0c7d11956d4
lib/oauth2client/appengine.py
python
OAuth2Decorator._create_flow
(self, request_handler)
Create the Flow object. The Flow is calculated lazily since we don't know where this app is running until it receives a request, at which point redirect_uri can be calculated and then the Flow object can be constructed. Args: request_handler: webapp.RequestHandler, the request handler.
Create the Flow object.
[ "Create", "the", "Flow", "object", "." ]
def _create_flow(self, request_handler): """Create the Flow object. The Flow is calculated lazily since we don't know where this app is running until it receives a request, at which point redirect_uri can be calculated and then the Flow object can be constructed. Args: request_handler: webap...
[ "def", "_create_flow", "(", "self", ",", "request_handler", ")", ":", "if", "self", ".", "flow", "is", "None", ":", "redirect_uri", "=", "request_handler", ".", "request", ".", "relative_url", "(", "self", ".", "_callback_path", ")", "# Usually /oauth2callback",...
https://github.com/Scarygami/mirror-api/blob/497783f6d721b24b793c1fcd8c71d0c7d11956d4/lib/oauth2client/appengine.py#L723-L742
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
scripts/cloudhealth/add_billing_role.py
python
parse_args
()
return args
parse CLI args
parse CLI args
[ "parse", "CLI", "args" ]
def parse_args(): ''' parse CLI args ''' # pylint: disable=line-too-long parser = argparse.ArgumentParser(description='MY SCRIPT DESCRIPTION') parser.add_argument('--overwrite', action='store_true', help='Overwrite any existing AWS objects') parser.add_argument('-f', '--file'...
[ "def", "parse_args", "(", ")", ":", "# pylint: disable=line-too-long", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'MY SCRIPT DESCRIPTION'", ")", "parser", ".", "add_argument", "(", "'--overwrite'", ",", "action", "=", "'store_true'", ...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/scripts/cloudhealth/add_billing_role.py#L46-L68
leaderj1001/Stand-Alone-Self-Attention
a983f0f643632b1f2b7b8b27693182f22e9e574c
preprocess.py
python
load_data
(args)
return train_loader, test_loader
[]
def load_data(args): print('Load Dataset :: {}'.format(args.dataset)) if args.dataset == 'CIFAR10': transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms.RandomHorizontalFlip(), transforms.ToTensor(), transforms.Normalize(...
[ "def", "load_data", "(", "args", ")", ":", "print", "(", "'Load Dataset :: {}'", ".", "format", "(", "args", ".", "dataset", ")", ")", "if", "args", ".", "dataset", "==", "'CIFAR10'", ":", "transform_train", "=", "transforms", ".", "Compose", "(", "[", "...
https://github.com/leaderj1001/Stand-Alone-Self-Attention/blob/a983f0f643632b1f2b7b8b27693182f22e9e574c/preprocess.py#L6-L98
mozillazg/pypy
2ff5cd960c075c991389f842c6d59e71cf0cb7d0
rpython/jit/metainterp/optimizeopt/vector.py
python
PackSet.prohibit_packing
(self, pack, packed, inquestion, forward)
return False
Blocks the packing of some operations
Blocks the packing of some operations
[ "Blocks", "the", "packing", "of", "some", "operations" ]
def prohibit_packing(self, pack, packed, inquestion, forward): """ Blocks the packing of some operations """ if inquestion.vector == -1: return True if packed.is_primitive_array_access(): if packed.getarg(1) is inquestion: return True if not forwar...
[ "def", "prohibit_packing", "(", "self", ",", "pack", ",", "packed", ",", "inquestion", ",", "forward", ")", ":", "if", "inquestion", ".", "vector", "==", "-", "1", ":", "return", "True", "if", "packed", ".", "is_primitive_array_access", "(", ")", ":", "i...
https://github.com/mozillazg/pypy/blob/2ff5cd960c075c991389f842c6d59e71cf0cb7d0/rpython/jit/metainterp/optimizeopt/vector.py#L739-L750
jgagneastro/coffeegrindsize
22661ebd21831dba4cf32bfc6ba59fe3d49f879c
App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/database.py
python
EggInfoDistribution.list_distinfo_files
(self, absolute=False)
Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``True``, each returned path is transformed in...
Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories.
[ "Iterates", "over", "the", "installed", "-", "files", ".", "txt", "entries", "and", "returns", "paths", "for", "each", "line", "if", "the", "path", "is", "pointing", "to", "a", "file", "located", "in", "the", ".", "egg", "-", "info", "directory", "or", ...
def list_distinfo_files(self, absolute=False): """ Iterates over the ``installed-files.txt`` entries and returns paths for each line if the path is pointing to a file located in the ``.egg-info`` directory or one of its subdirectories. :parameter absolute: If *absolute* is ``Tru...
[ "def", "list_distinfo_files", "(", "self", ",", "absolute", "=", "False", ")", ":", "record_path", "=", "os", ".", "path", ".", "join", "(", "self", ".", "path", ",", "'installed-files.txt'", ")", "if", "os", ".", "path", ".", "exists", "(", "record_path...
https://github.com/jgagneastro/coffeegrindsize/blob/22661ebd21831dba4cf32bfc6ba59fe3d49f879c/App/venv/lib/python3.7/site-packages/pip/_vendor/distlib/database.py#L1041-L1068
pytorch/fairseq
1575f30dd0a9f7b3c499db0b4767aa4e9f79056c
examples/wav2vec/unsupervised/scripts/wav2vec_cluster_faiss.py
python
Wav2VecFeatureReader.read_audio
(self, fname)
return wav
Load an audio file and return PCM along with the sample rate
Load an audio file and return PCM along with the sample rate
[ "Load", "an", "audio", "file", "and", "return", "PCM", "along", "with", "the", "sample", "rate" ]
def read_audio(self, fname): """Load an audio file and return PCM along with the sample rate""" wav, sr = sf.read(fname) assert sr == 16e3 return wav
[ "def", "read_audio", "(", "self", ",", "fname", ")", ":", "wav", ",", "sr", "=", "sf", ".", "read", "(", "fname", ")", "assert", "sr", "==", "16e3", "return", "wav" ]
https://github.com/pytorch/fairseq/blob/1575f30dd0a9f7b3c499db0b4767aa4e9f79056c/examples/wav2vec/unsupervised/scripts/wav2vec_cluster_faiss.py#L93-L98
readthedocs/readthedocs.org
0852d7c10d725d954d3e9a93513171baa1116d9f
readthedocs/organizations/templatetags/organizations.py
python
admin_teams
(user)
return Team.objects.admin(user)
Return admin teams across all orgs for a user.
Return admin teams across all orgs for a user.
[ "Return", "admin", "teams", "across", "all", "orgs", "for", "a", "user", "." ]
def admin_teams(user): """Return admin teams across all orgs for a user.""" return Team.objects.admin(user)
[ "def", "admin_teams", "(", "user", ")", ":", "return", "Team", ".", "objects", ".", "admin", "(", "user", ")" ]
https://github.com/readthedocs/readthedocs.org/blob/0852d7c10d725d954d3e9a93513171baa1116d9f/readthedocs/organizations/templatetags/organizations.py#L66-L68
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/core/parser/base_parser.py
python
BaseEnamlParser.set_context
(self, node, ctx, p)
Recursively sets the context of the node to the given context which should be Store or Del. If the node is not one of the allowed types for the context, an error is raised with an appropriate message.
Recursively sets the context of the node to the given context which should be Store or Del. If the node is not one of the allowed types for the context, an error is raised with an appropriate message.
[ "Recursively", "sets", "the", "context", "of", "the", "node", "to", "the", "given", "context", "which", "should", "be", "Store", "or", "Del", ".", "If", "the", "node", "is", "not", "one", "of", "the", "allowed", "types", "for", "the", "context", "an", ...
def set_context(self, node, ctx, p): """ Recursively sets the context of the node to the given context which should be Store or Del. If the node is not one of the allowed types for the context, an error is raised with an appropriate message. """ # XXX passing the yacc production...
[ "def", "set_context", "(", "self", ",", "node", ",", "ctx", ",", "p", ")", ":", "# XXX passing the yacc production object to raise the error", "# message is a bit flakey and gets things wrong occasionally", "# when there are blank lines around the error. We can do better.", "items", ...
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/core/parser/base_parser.py#L210-L246
Eugeny/reconfigure
ff1115dede4b80222a2618d0e7657cafa36a2573
reconfigure/parsers/iniparse/compat.py
python
ConfigParser._interpolate
(self, section, option, rawval, vars)
return value
[]
def _interpolate(self, section, option, rawval, vars): # do the string interpolation value = rawval depth = MAX_INTERPOLATION_DEPTH while depth: # Loop through this until it's done depth -= 1 if "%(" in value: try: ...
[ "def", "_interpolate", "(", "self", ",", "section", ",", "option", ",", "rawval", ",", "vars", ")", ":", "# do the string interpolation", "value", "=", "rawval", "depth", "=", "MAX_INTERPOLATION_DEPTH", "while", "depth", ":", "# Loop through this until it's done", "...
https://github.com/Eugeny/reconfigure/blob/ff1115dede4b80222a2618d0e7657cafa36a2573/reconfigure/parsers/iniparse/compat.py#L242-L258
yinhm/datafeed
62193278212c2441d8e49b45d71b8d9d79aab31c
datafeed/providers/tongshi.py
python
Report.symbol
(self)
return format_market(self.m_wMarket) + self.m_szLabel
[]
def symbol(self): return format_market(self.m_wMarket) + self.m_szLabel
[ "def", "symbol", "(", "self", ")", ":", "return", "format_market", "(", "self", ".", "m_wMarket", ")", "+", "self", ".", "m_szLabel" ]
https://github.com/yinhm/datafeed/blob/62193278212c2441d8e49b45d71b8d9d79aab31c/datafeed/providers/tongshi.py#L125-L126
rizar/attention-lvcsr
1ae52cafdd8419874846f9544a299eef9c758f3b
libs/Theano/theano/scan_module/scan_op.py
python
Scan.get_oinp_iinp_iout_oout_mappings
(self)
return mappings
Compute and return dictionary mappings between the inputs and outputs of the inner function and the inputs and outputs of the Scan node in the outer graph. The return value is a dictionary in which the keys are the names of the individual mappings and the values are the mapping dictiona...
Compute and return dictionary mappings between the inputs and outputs of the inner function and the inputs and outputs of the Scan node in the outer graph.
[ "Compute", "and", "return", "dictionary", "mappings", "between", "the", "inputs", "and", "outputs", "of", "the", "inner", "function", "and", "the", "inputs", "and", "outputs", "of", "the", "Scan", "node", "in", "the", "outer", "graph", "." ]
def get_oinp_iinp_iout_oout_mappings(self): """ Compute and return dictionary mappings between the inputs and outputs of the inner function and the inputs and outputs of the Scan node in the outer graph. The return value is a dictionary in which the keys are the names of ...
[ "def", "get_oinp_iinp_iout_oout_mappings", "(", "self", ")", ":", "# Lists for outer variables contain individual indices, lists for", "# inner variables contain sequences of indices because many inner", "# variables can be associated with the same outer variable. The list", "# and indices are ini...
https://github.com/rizar/attention-lvcsr/blob/1ae52cafdd8419874846f9544a299eef9c758f3b/libs/Theano/theano/scan_module/scan_op.py#L1769-L1923
facebookresearch/TaBERT
74aa4a88783825e71b71d1d0fdbc6b338047eea9
table_bert/vertical/vertical_attention_table_bert.py
python
VerticalAttentionTableBert.forward
( self, input_ids: torch.Tensor, segment_ids: torch.Tensor, context_token_positions: torch.Tensor, column_token_position_to_column_ids: torch.Tensor, sequence_mask: torch.Tensor, context_token_mask: torch.Tensor, table_mask: torch.Tensor, # masked_lm_labels: torch.Tensor = None ...
Args: input_ids: (batch_size, max_row_num, sequence_len) segment_ids: (batch_size, max_row_num, sequence_len) context_token_positions: (batch_size, max_row_num, max_context_len) column_token_position_to_column_ids: (batch_size, max_row_num, sequence_len) seque...
[]
def forward( self, input_ids: torch.Tensor, segment_ids: torch.Tensor, context_token_positions: torch.Tensor, column_token_position_to_column_ids: torch.Tensor, sequence_mask: torch.Tensor, context_token_mask: torch.Tensor, table_mask: torch.Tensor, # masked_lm_labels: torch.Tens...
[ "def", "forward", "(", "self", ",", "input_ids", ":", "torch", ".", "Tensor", ",", "segment_ids", ":", "torch", ".", "Tensor", ",", "context_token_positions", ":", "torch", ".", "Tensor", ",", "column_token_position_to_column_ids", ":", "torch", ".", "Tensor", ...
https://github.com/facebookresearch/TaBERT/blob/74aa4a88783825e71b71d1d0fdbc6b338047eea9/table_bert/vertical/vertical_attention_table_bert.py#L224-L394
meduza-corp/interstellar
40a801ccd7856491726f5a126621d9318cabe2e1
gsutil/third_party/boto/boto/redshift/layer1.py
python
RedshiftConnection.delete_hsm_configuration
(self, hsm_configuration_identifier)
return self._make_request( action='DeleteHsmConfiguration', verb='POST', path='/', params=params)
Deletes the specified Amazon Redshift HSM configuration. :type hsm_configuration_identifier: string :param hsm_configuration_identifier: The identifier of the Amazon Redshift HSM configuration to be deleted.
Deletes the specified Amazon Redshift HSM configuration.
[ "Deletes", "the", "specified", "Amazon", "Redshift", "HSM", "configuration", "." ]
def delete_hsm_configuration(self, hsm_configuration_identifier): """ Deletes the specified Amazon Redshift HSM configuration. :type hsm_configuration_identifier: string :param hsm_configuration_identifier: The identifier of the Amazon Redshift HSM configuration to be delete...
[ "def", "delete_hsm_configuration", "(", "self", ",", "hsm_configuration_identifier", ")", ":", "params", "=", "{", "'HsmConfigurationIdentifier'", ":", "hsm_configuration_identifier", ",", "}", "return", "self", ".", "_make_request", "(", "action", "=", "'DeleteHsmConfi...
https://github.com/meduza-corp/interstellar/blob/40a801ccd7856491726f5a126621d9318cabe2e1/gsutil/third_party/boto/boto/redshift/layer1.py#L1190-L1205
openhatch/oh-mainline
ce29352a034e1223141dcc2f317030bbc3359a51
vendor/packages/twisted/twisted/mail/alias.py
python
ProcessAlias.createMessageReceiver
(self)
return m
Create a message receiver by launching a process.
Create a message receiver by launching a process.
[ "Create", "a", "message", "receiver", "by", "launching", "a", "process", "." ]
def createMessageReceiver(self): """ Create a message receiver by launching a process. """ p = ProcessAliasProtocol() m = MessageWrapper(p, self.program, self.reactor) fd = self.spawnProcess(p, self.program, self.path) return m
[ "def", "createMessageReceiver", "(", "self", ")", ":", "p", "=", "ProcessAliasProtocol", "(", ")", "m", "=", "MessageWrapper", "(", "p", ",", "self", ".", "program", ",", "self", ".", "reactor", ")", "fd", "=", "self", ".", "spawnProcess", "(", "p", ",...
https://github.com/openhatch/oh-mainline/blob/ce29352a034e1223141dcc2f317030bbc3359a51/vendor/packages/twisted/twisted/mail/alias.py#L345-L352
apigee/henchman
13c53c66669800aaa89f1799ac974b45ec473c3d
modules/curl/curl/requests/requests/packages/urllib3/packages/ordered_dict.py
python
OrderedDict.__reduce__
(self)
return self.__class__, (items,)
Return state information for pickling
Return state information for pickling
[ "Return", "state", "information", "for", "pickling" ]
def __reduce__(self): 'Return state information for pickling' items = [[k, self[k]] for k in self] inst_dict = vars(self).copy() for k in vars(OrderedDict()): inst_dict.pop(k, None) if inst_dict: return (self.__class__, (items,), inst_dict) return ...
[ "def", "__reduce__", "(", "self", ")", ":", "items", "=", "[", "[", "k", ",", "self", "[", "k", "]", "]", "for", "k", "in", "self", "]", "inst_dict", "=", "vars", "(", "self", ")", ".", "copy", "(", ")", "for", "k", "in", "vars", "(", "Ordere...
https://github.com/apigee/henchman/blob/13c53c66669800aaa89f1799ac974b45ec473c3d/modules/curl/curl/requests/requests/packages/urllib3/packages/ordered_dict.py#L210-L218
HymanLiuTS/flaskTs
286648286976e85d9b9a5873632331efcafe0b21
flasky/lib/python2.7/site-packages/requests/api.py
python
request
(method, url, **kwargs)
Constructs and sends a :class:`Request <Request>`. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`. :param data: (optional) Dictionary, b...
Constructs and sends a :class:`Request <Request>`.
[ "Constructs", "and", "sends", "a", ":", "class", ":", "Request", "<Request", ">", "." ]
def request(method, url, **kwargs): """Constructs and sends a :class:`Request <Request>`. :param method: method for the new :class:`Request` object. :param url: URL for the new :class:`Request` object. :param params: (optional) Dictionary or bytes to be sent in the query string for the :class:`Request`...
[ "def", "request", "(", "method", ",", "url", ",", "*", "*", "kwargs", ")", ":", "# By using the 'with' statement we are sure the session is closed, thus we", "# avoid leaving sockets open which can trigger a ResourceWarning in some", "# cases, and look like a memory leak in others.", "...
https://github.com/HymanLiuTS/flaskTs/blob/286648286976e85d9b9a5873632331efcafe0b21/flasky/lib/python2.7/site-packages/requests/api.py#L16-L56
dropbox/dropbox-sdk-python
015437429be224732990041164a21a0501235db1
dropbox/team_log.py
python
SharedLinkVisibility.is_no_one
(self)
return self._tag == 'no_one'
Check if the union tag is ``no_one``. :rtype: bool
Check if the union tag is ``no_one``.
[ "Check", "if", "the", "union", "tag", "is", "no_one", "." ]
def is_no_one(self): """ Check if the union tag is ``no_one``. :rtype: bool """ return self._tag == 'no_one'
[ "def", "is_no_one", "(", "self", ")", ":", "return", "self", ".", "_tag", "==", "'no_one'" ]
https://github.com/dropbox/dropbox-sdk-python/blob/015437429be224732990041164a21a0501235db1/dropbox/team_log.py#L63674-L63680
openai/jukebox
08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3
tensorboardX/tensorboardX/caffe2_graph.py
python
_remap_keys
(old_dict, rename_fn)
Rename keys of 'old_dict' according to 'rename_fn'. Args: old_dict: Dictionary (i.e. containing blob_name -> blob_name relationships.) remap_fn: Function string -> string for renaming. Returns: None. Modifies old_dict in-place.
Rename keys of 'old_dict' according to 'rename_fn'.
[ "Rename", "keys", "of", "old_dict", "according", "to", "rename_fn", "." ]
def _remap_keys(old_dict, rename_fn): ''' Rename keys of 'old_dict' according to 'rename_fn'. Args: old_dict: Dictionary (i.e. containing blob_name -> blob_name relationships.) remap_fn: Function string -> string for renaming. Returns: None. Modifies old_dict in-pla...
[ "def", "_remap_keys", "(", "old_dict", ",", "rename_fn", ")", ":", "new_dict", "=", "{", "rename_fn", "(", "key", ")", ":", "value", "for", "key", ",", "value", "in", "six", ".", "iteritems", "(", "old_dict", ")", "}", "old_dict", ".", "clear", "(", ...
https://github.com/openai/jukebox/blob/08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3/tensorboardX/tensorboardX/caffe2_graph.py#L155-L170
Bashfuscator/Bashfuscator
7487348da2d0112213f8540ae28bf12b652f924a
bashfuscator/core/engine/random.py
python
RandomGen.probibility
(self, prob)
return randNum <= prob
Return True a certain percentage of the time. :param prob: probability of returning True :type prob: int :returns: True prob percent of the time, False otherwise
Return True a certain percentage of the time.
[ "Return", "True", "a", "certain", "percentage", "of", "the", "time", "." ]
def probibility(self, prob): """ Return True a certain percentage of the time. :param prob: probability of returning True :type prob: int :returns: True prob percent of the time, False otherwise """ randNum = self.randGenNum(0, 100) return randNum <= pro...
[ "def", "probibility", "(", "self", ",", "prob", ")", ":", "randNum", "=", "self", ".", "randGenNum", "(", "0", ",", "100", ")", "return", "randNum", "<=", "prob" ]
https://github.com/Bashfuscator/Bashfuscator/blob/7487348da2d0112213f8540ae28bf12b652f924a/bashfuscator/core/engine/random.py#L81-L91
jesolem/PCV
376d5975a033a7bde0102fa4b8fc29750d7fc98b
PCV/geometry/sfm.py
python
compute_P_from_fundamental
(F)
return vstack((dot(Te,F.T).T,e)).T
Computes the second camera matrix (assuming P1 = [I 0]) from a fundamental matrix.
Computes the second camera matrix (assuming P1 = [I 0]) from a fundamental matrix.
[ "Computes", "the", "second", "camera", "matrix", "(", "assuming", "P1", "=", "[", "I", "0", "]", ")", "from", "a", "fundamental", "matrix", "." ]
def compute_P_from_fundamental(F): """ Computes the second camera matrix (assuming P1 = [I 0]) from a fundamental matrix. """ e = compute_epipole(F.T) # left epipole Te = skew(e) return vstack((dot(Te,F.T).T,e)).T
[ "def", "compute_P_from_fundamental", "(", "F", ")", ":", "e", "=", "compute_epipole", "(", "F", ".", "T", ")", "# left epipole", "Te", "=", "skew", "(", "e", ")", "return", "vstack", "(", "(", "dot", "(", "Te", ",", "F", ".", "T", ")", ".", "T", ...
https://github.com/jesolem/PCV/blob/376d5975a033a7bde0102fa4b8fc29750d7fc98b/PCV/geometry/sfm.py#L124-L130
gleeda/memtriage
c24f4859995cccb9d88ccc0118d90693019cc1d5
volatility/volatility/utils.py
python
load_as
(config, astype = 'virtual', **kwargs)
return base_as
Loads an address space by stacking valid ASes on top of each other (priority order first)
Loads an address space by stacking valid ASes on top of each other (priority order first)
[ "Loads", "an", "address", "space", "by", "stacking", "valid", "ASes", "on", "top", "of", "each", "other", "(", "priority", "order", "first", ")" ]
def load_as(config, astype = 'virtual', **kwargs): """Loads an address space by stacking valid ASes on top of each other (priority order first)""" base_as = None error = exceptions.AddrSpaceError() # Start off requiring another round found = True ## A full iteration through all the classes...
[ "def", "load_as", "(", "config", ",", "astype", "=", "'virtual'", ",", "*", "*", "kwargs", ")", ":", "base_as", "=", "None", "error", "=", "exceptions", ".", "AddrSpaceError", "(", ")", "# Start off requiring another round ", "found", "=", "True", "## A ful...
https://github.com/gleeda/memtriage/blob/c24f4859995cccb9d88ccc0118d90693019cc1d5/volatility/volatility/utils.py#L31-L67
foxmask/django-th
29aa84f8d4aa945dbef6cf580593b435cc708e31
th_joplin/my_joplin.py
python
ServiceJoplin.read_data
(self, **kwargs)
get the data from the service as the pocket service does not have any date in its API linked to the note, add the triggered date to the dict data thus the service will be triggered when data will be found :param kwargs: contain keyword args : trigger_id at le...
get the data from the service as the pocket service does not have any date in its API linked to the note, add the triggered date to the dict data thus the service will be triggered when data will be found
[ "get", "the", "data", "from", "the", "service", "as", "the", "pocket", "service", "does", "not", "have", "any", "date", "in", "its", "API", "linked", "to", "the", "note", "add", "the", "triggered", "date", "to", "the", "dict", "data", "thus", "the", "s...
def read_data(self, **kwargs): """ get the data from the service as the pocket service does not have any date in its API linked to the note, add the triggered date to the dict data thus the service will be triggered when data will be found ...
[ "def", "read_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "trigger_id", "=", "kwargs", ".", "get", "(", "'trigger_id'", ")", "data", "=", "list", "(", ")", "cache", ".", "set", "(", "'th_joplin_'", "+", "str", "(", "trigger_id", ")", ",", ...
https://github.com/foxmask/django-th/blob/29aa84f8d4aa945dbef6cf580593b435cc708e31/th_joplin/my_joplin.py#L37-L52
PySimpleGUI/PySimpleGUI
6c0d1fb54f493d45e90180b322fbbe70f7a5af3c
PySimpleGUIWx/PySimpleGUIWx.py
python
theme_text_color
(color=None)
return DEFAULT_TEXT_COLOR
Sets/Returns the text color currently in use :return: (str) - color string of the text color currently in use
Sets/Returns the text color currently in use
[ "Sets", "/", "Returns", "the", "text", "color", "currently", "in", "use" ]
def theme_text_color(color=None): """ Sets/Returns the text color currently in use :return: (str) - color string of the text color currently in use """ if color is not None: set_options(text_color=color) return DEFAULT_TEXT_COLOR
[ "def", "theme_text_color", "(", "color", "=", "None", ")", ":", "if", "color", "is", "not", "None", ":", "set_options", "(", "text_color", "=", "color", ")", "return", "DEFAULT_TEXT_COLOR" ]
https://github.com/PySimpleGUI/PySimpleGUI/blob/6c0d1fb54f493d45e90180b322fbbe70f7a5af3c/PySimpleGUIWx/PySimpleGUIWx.py#L7018-L7026
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/gdata/youtube/service.py
python
YouTubeService.GetYouTubeSubscriptionEntry
(self, uri)
return self.Get( uri, converter=gdata.youtube.YouTubeSubscriptionEntryFromString)
Retrieve a YouTubeSubscriptionEntry. Args: uri: A string representing the URI of the entry that is to be retrieved. Returns: A YouTubeVideoSubscriptionEntry if successfully retrieved.
Retrieve a YouTubeSubscriptionEntry.
[ "Retrieve", "a", "YouTubeSubscriptionEntry", "." ]
def GetYouTubeSubscriptionEntry(self, uri): """Retrieve a YouTubeSubscriptionEntry. Args: uri: A string representing the URI of the entry that is to be retrieved. Returns: A YouTubeVideoSubscriptionEntry if successfully retrieved. """ return self.Get( uri, converter=gdata.youtu...
[ "def", "GetYouTubeSubscriptionEntry", "(", "self", ",", "uri", ")", ":", "return", "self", ".", "Get", "(", "uri", ",", "converter", "=", "gdata", ".", "youtube", ".", "YouTubeSubscriptionEntryFromString", ")" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/gdata/youtube/service.py#L448-L458
googleapis/google-auth-library-python
87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b
google/auth/_helpers.py
python
unpadded_urlsafe_b64encode
(value)
return base64.urlsafe_b64encode(value).rstrip(b"=")
Encodes base64 strings removing any padding characters. `rfc 7515`_ defines Base64url to NOT include any padding characters, but the stdlib doesn't do that by default. _rfc7515: https://tools.ietf.org/html/rfc7515#page-6 Args: value (Union[str|bytes]): The bytes-like value to encode Retu...
Encodes base64 strings removing any padding characters.
[ "Encodes", "base64", "strings", "removing", "any", "padding", "characters", "." ]
def unpadded_urlsafe_b64encode(value): """Encodes base64 strings removing any padding characters. `rfc 7515`_ defines Base64url to NOT include any padding characters, but the stdlib doesn't do that by default. _rfc7515: https://tools.ietf.org/html/rfc7515#page-6 Args: value (Union[str|byt...
[ "def", "unpadded_urlsafe_b64encode", "(", "value", ")", ":", "return", "base64", ".", "urlsafe_b64encode", "(", "value", ")", ".", "rstrip", "(", "b\"=\"", ")" ]
https://github.com/googleapis/google-auth-library-python/blob/87cd2455aca96ac3fbc4a8b2f8e4c0bba568a70b/google/auth/_helpers.py#L222-L236
kaaedit/kaa
e6a8819a5ecba04b7db8303bd5736b5a7c9b822d
kaa/options.py
python
build_parser
()
return parser
[]
def build_parser(): parser = argparse.ArgumentParser(description='kaa text editor.') parser.add_argument('--version', dest='show_version', action='store_true', default=False, help='show version info and exit') parser.add_argument('--no-init', dest='no_init', action='store_true', ...
[ "def", "build_parser", "(", ")", ":", "parser", "=", "argparse", ".", "ArgumentParser", "(", "description", "=", "'kaa text editor.'", ")", "parser", ".", "add_argument", "(", "'--version'", ",", "dest", "=", "'show_version'", ",", "action", "=", "'store_true'",...
https://github.com/kaaedit/kaa/blob/e6a8819a5ecba04b7db8303bd5736b5a7c9b822d/kaa/options.py#L4-L29
fooying/3102
0faee38c30b2e24154f41e68457cfd8f7a61c040
thirdparty/requests/api.py
python
options
(url, **kwargs)
return request('options', url, **kwargs)
Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes.
Sends a OPTIONS request. Returns :class:`Response` object.
[ "Sends", "a", "OPTIONS", "request", ".", "Returns", ":", "class", ":", "Response", "object", "." ]
def options(url, **kwargs): """Sends a OPTIONS request. Returns :class:`Response` object. :param url: URL for the new :class:`Request` object. :param \*\*kwargs: Optional arguments that ``request`` takes. """ kwargs.setdefault('allow_redirects', True) return request('options', url, **kwargs)
[ "def", "options", "(", "url", ",", "*", "*", "kwargs", ")", ":", "kwargs", ".", "setdefault", "(", "'allow_redirects'", ",", "True", ")", "return", "request", "(", "'options'", ",", "url", ",", "*", "*", "kwargs", ")" ]
https://github.com/fooying/3102/blob/0faee38c30b2e24154f41e68457cfd8f7a61c040/thirdparty/requests/api.py#L68-L76
openai/jukebox
08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3
tensorboardX/tensorboardX/writer.py
python
FileWriter.add_event
(self, event, step=None, walltime=None)
Adds an event to the event file. Args: event: An `Event` protocol buffer. step: Number. Optional global step value for training process to record with the event. walltime: float. Optional walltime to override the default (current) walltime (from time.time())
Adds an event to the event file. Args: event: An `Event` protocol buffer. step: Number. Optional global step value for training process to record with the event. walltime: float. Optional walltime to override the default (current) walltime (from time.time())
[ "Adds", "an", "event", "to", "the", "event", "file", ".", "Args", ":", "event", ":", "An", "Event", "protocol", "buffer", ".", "step", ":", "Number", ".", "Optional", "global", "step", "value", "for", "training", "process", "to", "record", "with", "the",...
def add_event(self, event, step=None, walltime=None): """Adds an event to the event file. Args: event: An `Event` protocol buffer. step: Number. Optional global step value for training process to record with the event. walltime: float. Optional walltime to overr...
[ "def", "add_event", "(", "self", ",", "event", ",", "step", "=", "None", ",", "walltime", "=", "None", ")", ":", "event", ".", "wall_time", "=", "time", ".", "time", "(", ")", "if", "walltime", "is", "None", "else", "walltime", "if", "step", "is", ...
https://github.com/openai/jukebox/blob/08efbbc1d4ed1a3cef96e08a931944c8b4d63bb3/tensorboardX/tensorboardX/writer.py#L99-L113
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py
python
iTXt.__new__
(cls, text, lang, tkey)
return self
:param cls: the class to use when creating the instance :param text: value for this key :param lang: language code :param tkey: UTF-8 version of the key name
:param cls: the class to use when creating the instance :param text: value for this key :param lang: language code :param tkey: UTF-8 version of the key name
[ ":", "param", "cls", ":", "the", "class", "to", "use", "when", "creating", "the", "instance", ":", "param", "text", ":", "value", "for", "this", "key", ":", "param", "lang", ":", "language", "code", ":", "param", "tkey", ":", "UTF", "-", "8", "versio...
def __new__(cls, text, lang, tkey): """ :param cls: the class to use when creating the instance :param text: value for this key :param lang: language code :param tkey: UTF-8 version of the key name """ self = str.__new__(cls, text) self.lang = lang ...
[ "def", "__new__", "(", "cls", ",", "text", ",", "lang", ",", "tkey", ")", ":", "self", "=", "str", ".", "__new__", "(", "cls", ",", "text", ")", "self", ".", "lang", "=", "lang", "self", ".", "tkey", "=", "tkey", "return", "self" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/PIL/PngImagePlugin.py#L186-L197
x1ah/Daily_scripts
fa6ad8a4f820876d98b919012e74017e9363badd
Baidu/baidu_count_login.py
python
start
(usrname, pswd)
[]
def start(usrname, pswd): # cookie = get_cookies() cookie = open("cookies", 'r').read() tieba = Baidu(cookie) # token = tieba.get_token() # res = tieba.login(token, usrname, pswd, cookie) tieba.sign_all_ba()
[ "def", "start", "(", "usrname", ",", "pswd", ")", ":", "# cookie = get_cookies()", "cookie", "=", "open", "(", "\"cookies\"", ",", "'r'", ")", ".", "read", "(", ")", "tieba", "=", "Baidu", "(", "cookie", ")", "# token = tieba.get_token()", "# res = ti...
https://github.com/x1ah/Daily_scripts/blob/fa6ad8a4f820876d98b919012e74017e9363badd/Baidu/baidu_count_login.py#L114-L120
makehumancommunity/makehuman
8006cf2cc851624619485658bb933a4244bbfd7c
makehuman/apps/humanmodifier.py
python
Modifier.getSimilar
(self)
return [m for m in self.human.getModifiersByType(type(self)) if m != self]
Retrieve the other modifiers of the same type on the human.
Retrieve the other modifiers of the same type on the human.
[ "Retrieve", "the", "other", "modifiers", "of", "the", "same", "type", "on", "the", "human", "." ]
def getSimilar(self): """ Retrieve the other modifiers of the same type on the human. """ return [m for m in self.human.getModifiersByType(type(self)) if m != self]
[ "def", "getSimilar", "(", "self", ")", ":", "return", "[", "m", "for", "m", "in", "self", ".", "human", ".", "getModifiersByType", "(", "type", "(", "self", ")", ")", "if", "m", "!=", "self", "]" ]
https://github.com/makehumancommunity/makehuman/blob/8006cf2cc851624619485658bb933a4244bbfd7c/makehuman/apps/humanmodifier.py#L329-L333
nodejs/node-gyp
a2f298870692022302fa27a1d42363c4a72df407
gyp/pylib/gyp/generator/analyzer.py
python
_GetOrCreateTargetByName
(targets, target_name)
return True, target
Creates or returns the Target at targets[target_name]. If there is no Target for |target_name| one is created. Returns a tuple of whether a new Target was created and the Target.
Creates or returns the Target at targets[target_name]. If there is no Target for |target_name| one is created. Returns a tuple of whether a new Target was created and the Target.
[ "Creates", "or", "returns", "the", "Target", "at", "targets", "[", "target_name", "]", ".", "If", "there", "is", "no", "Target", "for", "|target_name|", "one", "is", "created", ".", "Returns", "a", "tuple", "of", "whether", "a", "new", "Target", "was", "...
def _GetOrCreateTargetByName(targets, target_name): """Creates or returns the Target at targets[target_name]. If there is no Target for |target_name| one is created. Returns a tuple of whether a new Target was created and the Target.""" if target_name in targets: return False, targets[target_name] ...
[ "def", "_GetOrCreateTargetByName", "(", "targets", ",", "target_name", ")", ":", "if", "target_name", "in", "targets", ":", "return", "False", ",", "targets", "[", "target_name", "]", "target", "=", "Target", "(", "target_name", ")", "targets", "[", "target_na...
https://github.com/nodejs/node-gyp/blob/a2f298870692022302fa27a1d42363c4a72df407/gyp/pylib/gyp/generator/analyzer.py#L319-L327
pydicom/pynetdicom
f57d8214c82b63c8e76638af43ce331f584a80fa
pynetdicom/pdu_primitives.py
python
A_ASSOCIATE.diagnostic
(self, value: Optional[int])
Set the A-ASSOCIATE Service primitive's Diagnostic parameter.
Set the A-ASSOCIATE Service primitive's Diagnostic parameter.
[ "Set", "the", "A", "-", "ASSOCIATE", "Service", "primitive", "s", "Diagnostic", "parameter", "." ]
def diagnostic(self, value: Optional[int]) -> None: """ Set the A-ASSOCIATE Service primitive's Diagnostic parameter.""" # pylint: disable=attribute-defined-outside-init if value is None: pass elif value not in [1, 2, 3, 7]: LOGGER.error("A_ASSOCIATE.diagn...
[ "def", "diagnostic", "(", "self", ",", "value", ":", "Optional", "[", "int", "]", ")", "->", "None", ":", "# pylint: disable=attribute-defined-outside-init", "if", "value", "is", "None", ":", "pass", "elif", "value", "not", "in", "[", "1", ",", "2", ",", ...
https://github.com/pydicom/pynetdicom/blob/f57d8214c82b63c8e76638af43ce331f584a80fa/pynetdicom/pdu_primitives.py#L347-L357
weinbe58/QuSpin
5bbc3204dbf5c227a87a44f0dacf39509cba580c
sphinx/doc_examples/user_basis-example.py
python
pre_check_state
(s,N,args)
return (((s_shift_right|s_shift_left)&s))==0
imposes that that a bit with 1 must be preceded and followed by 0, i.e. a particle on a given site must have empty neighboring sites. # Works only for lattices of up to N=32 sites (otherwise, change mask) #
imposes that that a bit with 1 must be preceded and followed by 0, i.e. a particle on a given site must have empty neighboring sites. # Works only for lattices of up to N=32 sites (otherwise, change mask) #
[ "imposes", "that", "that", "a", "bit", "with", "1", "must", "be", "preceded", "and", "followed", "by", "0", "i", ".", "e", ".", "a", "particle", "on", "a", "given", "site", "must", "have", "empty", "neighboring", "sites", ".", "#", "Works", "only", "...
def pre_check_state(s,N,args): """ imposes that that a bit with 1 must be preceded and followed by 0, i.e. a particle on a given site must have empty neighboring sites. # Works only for lattices of up to N=32 sites (otherwise, change mask) # """ mask = (0xffffffff >> (32 - N)) # works for la...
[ "def", "pre_check_state", "(", "s", ",", "N", ",", "args", ")", ":", "mask", "=", "(", "0xffffffff", ">>", "(", "32", "-", "N", ")", ")", "# works for lattices of up to 32 sites", "# cycle bits left by 1 periodically", "s_shift_left", "=", "(", "(", "(", "s", ...
https://github.com/weinbe58/QuSpin/blob/5bbc3204dbf5c227a87a44f0dacf39509cba580c/sphinx/doc_examples/user_basis-example.py#L49-L63
WenmuZhou/PytorchOCR
0b2b3a67814ae40b20f3814d6793f5d75d644e38
torchocr/postprocess/__init__.py
python
build_post_process
(config)
return post_process
get architecture model class
get architecture model class
[ "get", "architecture", "model", "class" ]
def build_post_process(config): """ get architecture model class """ copy_config = copy.deepcopy(config) post_process_type = copy_config.pop('type') assert post_process_type in support_post_process, f'{post_process_type} is not developed yet!, only {support_post_process} are support now' pos...
[ "def", "build_post_process", "(", "config", ")", ":", "copy_config", "=", "copy", ".", "deepcopy", "(", "config", ")", "post_process_type", "=", "copy_config", ".", "pop", "(", "'type'", ")", "assert", "post_process_type", "in", "support_post_process", ",", "f'{...
https://github.com/WenmuZhou/PytorchOCR/blob/0b2b3a67814ae40b20f3814d6793f5d75d644e38/torchocr/postprocess/__init__.py#L12-L20
shellphish/ictf-framework
c0384f12060cf47442a52f516c6e78bd722f208a
database/support/mysql-connector-python-2.1.3/lib/mysql/connector/cursor.py
python
MySQLCursor.__iter__
(self)
return iter(self.fetchone, None)
Iteration over the result set which calls self.fetchone() and returns the next row.
Iteration over the result set which calls self.fetchone() and returns the next row.
[ "Iteration", "over", "the", "result", "set", "which", "calls", "self", ".", "fetchone", "()", "and", "returns", "the", "next", "row", "." ]
def __iter__(self): """ Iteration over the result set which calls self.fetchone() and returns the next row. """ return iter(self.fetchone, None)
[ "def", "__iter__", "(", "self", ")", ":", "return", "iter", "(", "self", ".", "fetchone", ",", "None", ")" ]
https://github.com/shellphish/ictf-framework/blob/c0384f12060cf47442a52f516c6e78bd722f208a/database/support/mysql-connector-python-2.1.3/lib/mysql/connector/cursor.py#L285-L290
opencobra/cobrapy
0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2
src/cobra/core/reaction.py
python
Reaction.get_compartments
(self)
return list(self.compartments)
lists compartments the metabolites are in
lists compartments the metabolites are in
[ "lists", "compartments", "the", "metabolites", "are", "in" ]
def get_compartments(self): """lists compartments the metabolites are in""" warn("use Reaction.compartments instead", DeprecationWarning) return list(self.compartments)
[ "def", "get_compartments", "(", "self", ")", ":", "warn", "(", "\"use Reaction.compartments instead\"", ",", "DeprecationWarning", ")", "return", "list", "(", "self", ".", "compartments", ")" ]
https://github.com/opencobra/cobrapy/blob/0b9ea70cb0ffe78568d445ce3361ad10ec6b02a2/src/cobra/core/reaction.py#L980-L983
Pyomo/pyomo
dbd4faee151084f343b893cc2b0c04cf2b76fd92
pyomo/contrib/pyros/uncertainty_sets.py
python
IntersectionSet.set_as_constraint
(self, uncertain_params, **kwargs)
Function to generate constraints for the IntersectedSet uncertainty set. Args: uncertain_params: list of uncertain param objects participating in the sets to be intersected
Function to generate constraints for the IntersectedSet uncertainty set. Args: uncertain_params: list of uncertain param objects participating in the sets to be intersected
[ "Function", "to", "generate", "constraints", "for", "the", "IntersectedSet", "uncertainty", "set", ".", "Args", ":", "uncertain_params", ":", "list", "of", "uncertain", "param", "objects", "participating", "in", "the", "sets", "to", "be", "intersected" ]
def set_as_constraint(self, uncertain_params, **kwargs): """ Function to generate constraints for the IntersectedSet uncertainty set. Args: uncertain_params: list of uncertain param objects participating in the sets to be intersected """ try: nlp_solver = ...
[ "def", "set_as_constraint", "(", "self", ",", "uncertain_params", ",", "*", "*", "kwargs", ")", ":", "try", ":", "nlp_solver", "=", "kwargs", "[", "\"config\"", "]", ".", "global_solver", "except", ":", "raise", "AttributeError", "(", "\"set_as_constraint for Se...
https://github.com/Pyomo/pyomo/blob/dbd4faee151084f343b893cc2b0c04cf2b76fd92/pyomo/contrib/pyros/uncertainty_sets.py#L1128-L1157
realpython/book2-exercises
cde325eac8e6d8cff2316601c2e5b36bb46af7d0
py2manager/gluon/contrib/ipaddr.py
python
_BaseNet.numhosts
(self)
return int(self.broadcast) - int(self.network) + 1
Number of hosts in the current subnet.
Number of hosts in the current subnet.
[ "Number", "of", "hosts", "in", "the", "current", "subnet", "." ]
def numhosts(self): """Number of hosts in the current subnet.""" return int(self.broadcast) - int(self.network) + 1
[ "def", "numhosts", "(", "self", ")", ":", "return", "int", "(", "self", ".", "broadcast", ")", "-", "int", "(", "self", ".", "network", ")", "+", "1" ]
https://github.com/realpython/book2-exercises/blob/cde325eac8e6d8cff2316601c2e5b36bb46af7d0/py2manager/gluon/contrib/ipaddr.py#L691-L693
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/ctypes/__init__.py
python
_reset_cache
()
[]
def _reset_cache(): _pointer_type_cache.clear() _c_functype_cache.clear() if _os.name in ("nt", "ce"): _win_functype_cache.clear() # _SimpleCData.c_wchar_p_from_param POINTER(c_wchar).from_param = c_wchar_p.from_param # _SimpleCData.c_char_p_from_param POINTER(c_char).from_param = c_...
[ "def", "_reset_cache", "(", ")", ":", "_pointer_type_cache", ".", "clear", "(", ")", "_c_functype_cache", ".", "clear", "(", ")", "if", "_os", ".", "name", "in", "(", "\"nt\"", ",", "\"ce\"", ")", ":", "_win_functype_cache", ".", "clear", "(", ")", "# _S...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/ctypes/__init__.py#L266-L280
jliljebl/flowblade
995313a509b80e99eb1ad550d945bdda5995093b
flowblade-trunk/Flowblade/vieweditor/vieweditorlayer.py
python
AbstactEditorLayer.__init__
(self, view_editor)
[]
def __init__(self, view_editor): self.view_editor = view_editor self.edit_point_shape = None self.name = "unnamed layer" self.active = False self.visible = True self.last_pressed_edit_point = None self.mouse_start_point = None self.mouse_current_point = No...
[ "def", "__init__", "(", "self", ",", "view_editor", ")", ":", "self", ".", "view_editor", "=", "view_editor", "self", ".", "edit_point_shape", "=", "None", "self", ".", "name", "=", "\"unnamed layer\"", "self", ".", "active", "=", "False", "self", ".", "vi...
https://github.com/jliljebl/flowblade/blob/995313a509b80e99eb1ad550d945bdda5995093b/flowblade-trunk/Flowblade/vieweditor/vieweditorlayer.py#L44-L58
home-assistant/core
265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1
homeassistant/components/tuya/fan.py
python
TuyaFanEntity.set_preset_mode
(self, preset_mode: str)
Set the preset mode of the fan.
Set the preset mode of the fan.
[ "Set", "the", "preset", "mode", "of", "the", "fan", "." ]
def set_preset_mode(self, preset_mode: str) -> None: """Set the preset mode of the fan.""" self._send_command([{"code": DPCode.MODE, "value": preset_mode}])
[ "def", "set_preset_mode", "(", "self", ",", "preset_mode", ":", "str", ")", "->", "None", ":", "self", ".", "_send_command", "(", "[", "{", "\"code\"", ":", "DPCode", ".", "MODE", ",", "\"value\"", ":", "preset_mode", "}", "]", ")" ]
https://github.com/home-assistant/core/blob/265ebd17a3f17ed8dc1e9bdede03ac8e323f1ab1/homeassistant/components/tuya/fan.py#L95-L97
Logan1x/Python-Scripts
e611dae0c86af21aad2bf11100bcc0448aa16fd0
bin/integrate-graph.py
python
Integrate.__init__
(self)
[]
def __init__(self): self.N = None self.I = None
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "N", "=", "None", "self", ".", "I", "=", "None" ]
https://github.com/Logan1x/Python-Scripts/blob/e611dae0c86af21aad2bf11100bcc0448aa16fd0/bin/integrate-graph.py#L14-L16
zhoubear/open-paperless
b42d4e3bc88343ca5803c613321327406eabca1a
mayan/apps/documents/api_views.py
python
APIDocumentTypeView.get
(self, *args, **kwargs)
return super(APIDocumentTypeView, self).get(*args, **kwargs)
Return the details of the selected document type.
Return the details of the selected document type.
[ "Return", "the", "details", "of", "the", "selected", "document", "type", "." ]
def get(self, *args, **kwargs): """ Return the details of the selected document type. """ return super(APIDocumentTypeView, self).get(*args, **kwargs)
[ "def", "get", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "return", "super", "(", "APIDocumentTypeView", ",", "self", ")", ".", "get", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/zhoubear/open-paperless/blob/b42d4e3bc88343ca5803c613321327406eabca1a/mayan/apps/documents/api_views.py#L464-L469
mdiazcl/fuzzbunch-debian
2b76c2249ade83a389ae3badb12a1bd09901fd2c
windows/Resources/Python/Core/Lib/distutils/command/check.py
python
check.check_restructuredtext
(self)
return
Checks if the long string fields are reST-compliant.
Checks if the long string fields are reST-compliant.
[ "Checks", "if", "the", "long", "string", "fields", "are", "reST", "-", "compliant", "." ]
def check_restructuredtext(self): """Checks if the long string fields are reST-compliant.""" data = self.distribution.get_long_description() for warning in self._check_rst_data(data): line = warning[-1].get('line') if line is None: warning = warning[1] ...
[ "def", "check_restructuredtext", "(", "self", ")", ":", "data", "=", "self", ".", "distribution", ".", "get_long_description", "(", ")", "for", "warning", "in", "self", ".", "_check_rst_data", "(", "data", ")", ":", "line", "=", "warning", "[", "-", "1", ...
https://github.com/mdiazcl/fuzzbunch-debian/blob/2b76c2249ade83a389ae3badb12a1bd09901fd2c/windows/Resources/Python/Core/Lib/distutils/command/check.py#L96-L107
VLSIDA/OpenRAM
f66aac3264598eeae31225c62b6a4af52412d407
compiler/pgates/precharge.py
python
precharge.place_ptx
(self)
Place both the upper_pmos and lower_pmos to the module
Place both the upper_pmos and lower_pmos to the module
[ "Place", "both", "the", "upper_pmos", "and", "lower_pmos", "to", "the", "module" ]
def place_ptx(self): """ Place both the upper_pmos and lower_pmos to the module """ # reserve some offset to jog the bitlines self.initial_yoffset = self.pmos.active_offset.y + self.m2_pitch # Compute the other pmos2 location, # but determining offset to overlap ...
[ "def", "place_ptx", "(", "self", ")", ":", "# reserve some offset to jog the bitlines", "self", ".", "initial_yoffset", "=", "self", ".", "pmos", ".", "active_offset", ".", "y", "+", "self", ".", "m2_pitch", "# Compute the other pmos2 location,", "# but determining offs...
https://github.com/VLSIDA/OpenRAM/blob/f66aac3264598eeae31225c62b6a4af52412d407/compiler/pgates/precharge.py#L140-L163
SteveDoyle2/pyNastran
eda651ac2d4883d95a34951f8a002ff94f642a1a
pyNastran/dev/bdf_vectorized/bdf.py
python
BDF._prepare_dequatn
(self, card, card_obj, comment='')
adds a DEQATN
adds a DEQATN
[ "adds", "a", "DEQATN" ]
def _prepare_dequatn(self, card, card_obj, comment=''): """adds a DEQATN""" if hasattr(self, 'test_deqatn') or 1: self.add_deqatn(DEQATN.add_card(card_obj, comment=comment)) else: if comment: self.rejects.append([comment]) self.rejects.append(c...
[ "def", "_prepare_dequatn", "(", "self", ",", "card", ",", "card_obj", ",", "comment", "=", "''", ")", ":", "if", "hasattr", "(", "self", ",", "'test_deqatn'", ")", "or", "1", ":", "self", ".", "add_deqatn", "(", "DEQATN", ".", "add_card", "(", "card_ob...
https://github.com/SteveDoyle2/pyNastran/blob/eda651ac2d4883d95a34951f8a002ff94f642a1a/pyNastran/dev/bdf_vectorized/bdf.py#L2063-L2070
nosmokingbandit/Watcher3
0217e75158b563bdefc8e01c3be7620008cf3977
lib/cheroot/server.py
python
HTTPServer.tick
(self)
Accept a new connection and put it on the Queue.
Accept a new connection and put it on the Queue.
[ "Accept", "a", "new", "connection", "and", "put", "it", "on", "the", "Queue", "." ]
def tick(self): """Accept a new connection and put it on the Queue.""" try: s, addr = self.socket.accept() if self.stats['Enabled']: self.stats['Accepts'] += 1 if not self.ready: return prevent_socket_inheritance(s) ...
[ "def", "tick", "(", "self", ")", ":", "try", ":", "s", ",", "addr", "=", "self", ".", "socket", ".", "accept", "(", ")", "if", "self", ".", "stats", "[", "'Enabled'", "]", ":", "self", ".", "stats", "[", "'Accepts'", "]", "+=", "1", "if", "not"...
https://github.com/nosmokingbandit/Watcher3/blob/0217e75158b563bdefc8e01c3be7620008cf3977/lib/cheroot/server.py#L1523-L1613
Robpol86/Flask-Celery-Helper
92bd3b02954422665260116adda8eb899546c365
flask_celery.py
python
_LockManager.task_identifier
(self)
return task_id
Return the unique identifier (string) of a task instance.
Return the unique identifier (string) of a task instance.
[ "Return", "the", "unique", "identifier", "(", "string", ")", "of", "a", "task", "instance", "." ]
def task_identifier(self): """Return the unique identifier (string) of a task instance.""" task_id = self.celery_self.name if self.include_args: merged_args = str(self.args) + str([(k, self.kwargs[k]) for k in sorted(self.kwargs)]) task_id += '.args.{0}'.format(hashlib.md...
[ "def", "task_identifier", "(", "self", ")", ":", "task_id", "=", "self", ".", "celery_self", ".", "name", "if", "self", ".", "include_args", ":", "merged_args", "=", "str", "(", "self", ".", "args", ")", "+", "str", "(", "[", "(", "k", ",", "self", ...
https://github.com/Robpol86/Flask-Celery-Helper/blob/92bd3b02954422665260116adda8eb899546c365/flask_celery.py#L46-L52
bruderstein/PythonScript
df9f7071ddf3a079e3a301b9b53a6dc78cf1208f
PythonLib/full/xmlrpc/client.py
python
loads
(data, use_datetime=False, use_builtin_types=False)
return u.close(), u.getmethodname()
data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception.
data -> unmarshalled data, method name
[ "data", "-", ">", "unmarshalled", "data", "method", "name" ]
def loads(data, use_datetime=False, use_builtin_types=False): """data -> unmarshalled data, method name Convert an XML-RPC packet to unmarshalled data plus a method name (None if not present). If the XML-RPC packet represents a fault condition, this function raises a Fault exception. """ p...
[ "def", "loads", "(", "data", ",", "use_datetime", "=", "False", ",", "use_builtin_types", "=", "False", ")", ":", "p", ",", "u", "=", "getparser", "(", "use_datetime", "=", "use_datetime", ",", "use_builtin_types", "=", "use_builtin_types", ")", "p", ".", ...
https://github.com/bruderstein/PythonScript/blob/df9f7071ddf3a079e3a301b9b53a6dc78cf1208f/PythonLib/full/xmlrpc/client.py#L1019-L1031
FabriceSalvaire/PySpice
1fb97dc21abcf04cfd78802671322eef5c0de00b
PySpice/Spice/NgSpice/Shared.py
python
NgSpiceShared.exec_command
(self, command, join_lines=True)
Execute a command and return the output.
Execute a command and return the output.
[ "Execute", "a", "command", "and", "return", "the", "output", "." ]
def exec_command(self, command, join_lines=True): """ Execute a command and return the output. """ # Ngspice API: ngSpice_Command # Prevent memory leaks by periodically freeing ngspice history of past commands # Each command sent to ngspice is stored in the control structures ...
[ "def", "exec_command", "(", "self", ",", "command", ",", "join_lines", "=", "True", ")", ":", "# Ngspice API: ngSpice_Command", "# Prevent memory leaks by periodically freeing ngspice history of past commands", "# Each command sent to ngspice is stored in the control structures", "if...
https://github.com/FabriceSalvaire/PySpice/blob/1fb97dc21abcf04cfd78802671322eef5c0de00b/PySpice/Spice/NgSpice/Shared.py#L823-L856
TengXiaoDai/DistributedCrawling
f5c2439e6ce68dd9b49bde084d76473ff9ed4963
Lib/site-packages/pkg_resources/__init__.py
python
_version_from_file
(lines)
return safe_version(value.strip()) or None
Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise.
Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise.
[ "Given", "an", "iterable", "of", "lines", "from", "a", "Metadata", "file", "return", "the", "value", "of", "the", "Version", "field", "if", "present", "or", "None", "otherwise", "." ]
def _version_from_file(lines): """ Given an iterable of lines from a Metadata file, return the value of the Version field, if present, or None otherwise. """ is_version_line = lambda line: line.lower().startswith('version:') version_lines = filter(is_version_line, lines) line = next(iter(ver...
[ "def", "_version_from_file", "(", "lines", ")", ":", "is_version_line", "=", "lambda", "line", ":", "line", ".", "lower", "(", ")", ".", "startswith", "(", "'version:'", ")", "version_lines", "=", "filter", "(", "is_version_line", ",", "lines", ")", "line", ...
https://github.com/TengXiaoDai/DistributedCrawling/blob/f5c2439e6ce68dd9b49bde084d76473ff9ed4963/Lib/site-packages/pkg_resources/__init__.py#L2407-L2416
IntelAI/models
1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c
models/language_translation/tensorflow/transformer_lt_official/inference/fp32/official/utils/flags/core.py
python
register_key_flags_in_core
(f)
return core_fn
Defines a function in core.py, and registers its key flags. absl uses the location of a flags.declare_key_flag() to determine the context in which a flag is key. By making all declares in core, this allows model main functions to call flags.adopt_module_key_flags() on core and correctly chain key flags. Arg...
Defines a function in core.py, and registers its key flags.
[ "Defines", "a", "function", "in", "core", ".", "py", "and", "registers", "its", "key", "flags", "." ]
def register_key_flags_in_core(f): """Defines a function in core.py, and registers its key flags. absl uses the location of a flags.declare_key_flag() to determine the context in which a flag is key. By making all declares in core, this allows model main functions to call flags.adopt_module_key_flags() on core...
[ "def", "register_key_flags_in_core", "(", "f", ")", ":", "def", "core_fn", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "key_flags", "=", "f", "(", "*", "args", ",", "*", "*", "kwargs", ")", "[", "flags", ".", "declare_key_flag", "(", "fl", ...
https://github.com/IntelAI/models/blob/1d7a53ccfad3e6f0e7378c9e3c8840895d63df8c/models/language_translation/tensorflow/transformer_lt_official/inference/fp32/official/utils/flags/core.py#L50-L68
IronLanguages/ironpython3
7a7bb2a872eeab0d1009fc8a6e24dca43f65b693
Src/StdLib/Lib/netrc.py
python
NetrcParseError.__init__
(self, msg, filename=None, lineno=None)
[]
def __init__(self, msg, filename=None, lineno=None): self.filename = filename self.lineno = lineno self.msg = msg Exception.__init__(self, msg)
[ "def", "__init__", "(", "self", ",", "msg", ",", "filename", "=", "None", ",", "lineno", "=", "None", ")", ":", "self", ".", "filename", "=", "filename", "self", ".", "lineno", "=", "lineno", "self", ".", "msg", "=", "msg", "Exception", ".", "__init_...
https://github.com/IronLanguages/ironpython3/blob/7a7bb2a872eeab0d1009fc8a6e24dca43f65b693/Src/StdLib/Lib/netrc.py#L12-L16
tav/pylibs
3c16b843681f54130ee6a022275289cadb2f2a69
docutils/frontend.py
python
OptionParser.get_config_file_settings
(self, config_file)
return settings.__dict__
Returns a dictionary containing appropriate config file settings.
Returns a dictionary containing appropriate config file settings.
[ "Returns", "a", "dictionary", "containing", "appropriate", "config", "file", "settings", "." ]
def get_config_file_settings(self, config_file): """Returns a dictionary containing appropriate config file settings.""" parser = ConfigParser() parser.read(config_file, self) self.config_files.extend(parser._files) base_path = os.path.dirname(config_file) applied = {} ...
[ "def", "get_config_file_settings", "(", "self", ",", "config_file", ")", ":", "parser", "=", "ConfigParser", "(", ")", "parser", ".", "read", "(", "config_file", ",", "self", ")", "self", ".", "config_files", ".", "extend", "(", "parser", ".", "_files", ")...
https://github.com/tav/pylibs/blob/3c16b843681f54130ee6a022275289cadb2f2a69/docutils/frontend.py#L577-L596
twilio/twilio-python
6e1e811ea57a1edfadd5161ace87397c563f6915
twilio/rest/preview/understand/assistant/task/__init__.py
python
TaskPage.__repr__
(self)
return '<Twilio.Preview.Understand.TaskPage>'
Provide a friendly representation :returns: Machine friendly representation :rtype: str
Provide a friendly representation
[ "Provide", "a", "friendly", "representation" ]
def __repr__(self): """ Provide a friendly representation :returns: Machine friendly representation :rtype: str """ return '<Twilio.Preview.Understand.TaskPage>'
[ "def", "__repr__", "(", "self", ")", ":", "return", "'<Twilio.Preview.Understand.TaskPage>'" ]
https://github.com/twilio/twilio-python/blob/6e1e811ea57a1edfadd5161ace87397c563f6915/twilio/rest/preview/understand/assistant/task/__init__.py#L208-L215
ReactionMechanismGenerator/RMG-Py
2b7baf51febf27157def58fb3f6cee03fb6a684c
rmgpy/data/kinetics/family.py
python
KineticsFamily.get_rxn_batches
(self, rxns, T=1000.0, max_batch_size=800, outlier_fraction=0.02, stratum_num=8)
return batches
Breaks reactions into batches based on a modified stratified sampling scheme Effectively: The top and bottom outlier_fraction of all reactions are always included in the first batch The remaining reactions are ordered by the rate coefficients at T The list of reactions is then split into...
Breaks reactions into batches based on a modified stratified sampling scheme Effectively: The top and bottom outlier_fraction of all reactions are always included in the first batch The remaining reactions are ordered by the rate coefficients at T The list of reactions is then split into...
[ "Breaks", "reactions", "into", "batches", "based", "on", "a", "modified", "stratified", "sampling", "scheme", "Effectively", ":", "The", "top", "and", "bottom", "outlier_fraction", "of", "all", "reactions", "are", "always", "included", "in", "the", "first", "bat...
def get_rxn_batches(self, rxns, T=1000.0, max_batch_size=800, outlier_fraction=0.02, stratum_num=8): """ Breaks reactions into batches based on a modified stratified sampling scheme Effectively: The top and bottom outlier_fraction of all reactions are always included in the first batch ...
[ "def", "get_rxn_batches", "(", "self", ",", "rxns", ",", "T", "=", "1000.0", ",", "max_batch_size", "=", "800", ",", "outlier_fraction", "=", "0.02", ",", "stratum_num", "=", "8", ")", ":", "ks", "=", "np", ".", "array", "(", "[", "rxn", ".", "kineti...
https://github.com/ReactionMechanismGenerator/RMG-Py/blob/2b7baf51febf27157def58fb3f6cee03fb6a684c/rmgpy/data/kinetics/family.py#L3376-L3427
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/tableau.py
python
Tableaux_size.__init__
(self, n)
r""" Initializes the class of tableaux of size ``n``. TESTS:: sage: T = sage.combinat.tableau.Tableaux_size(3) sage: TestSuite(T).run() sage: T = sage.combinat.tableau.Tableaux_size(0) sage: TestSuite(T).run()
r""" Initializes the class of tableaux of size ``n``.
[ "r", "Initializes", "the", "class", "of", "tableaux", "of", "size", "n", "." ]
def __init__(self, n): r""" Initializes the class of tableaux of size ``n``. TESTS:: sage: T = sage.combinat.tableau.Tableaux_size(3) sage: TestSuite(T).run() sage: T = sage.combinat.tableau.Tableaux_size(0) sage: TestSuite(T).run() """ ...
[ "def", "__init__", "(", "self", ",", "n", ")", ":", "super", "(", "Tableaux_size", ",", "self", ")", ".", "__init__", "(", "category", "=", "Sets", "(", ")", ")", "self", ".", "size", "=", "n" ]
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/tableau.py#L5592-L5605
careermonk/data-structures-and-algorithmic-thinking-with-python
3c07d9dcec4fd06d0958a96fecd5e228f0378112
src/chapter06trees/ClosestInBSTWithLevelOrder.py
python
findMin
(root, parent)
return the minimum node in the current tree and its parent
return the minimum node in the current tree and its parent
[ "return", "the", "minimum", "node", "in", "the", "current", "tree", "and", "its", "parent" ]
def findMin(root, parent): """ return the minimum node in the current tree and its parent """ # we use an ugly trick: the parent node is passed in as an argument # so that eventually when the leftmost child is reached, the # call can return both the parent to the successor and the successor if root.left: return...
[ "def", "findMin", "(", "root", ",", "parent", ")", ":", "# we use an ugly trick: the parent node is passed in as an argument", "# so that eventually when the leftmost child is reached, the ", "# call can return both the parent to the successor and the successor", "if", "root", ".", "left...
https://github.com/careermonk/data-structures-and-algorithmic-thinking-with-python/blob/3c07d9dcec4fd06d0958a96fecd5e228f0378112/src/chapter06trees/ClosestInBSTWithLevelOrder.py#L165-L173
facebookresearch/DrQA
6d7c1b7087b86cfe9bdf84a279adb58dceada3cd
drqa/retriever/tfidf_doc_ranker.py
python
TfidfDocRanker.closest_docs
(self, query, k=1)
return doc_ids, doc_scores
Closest docs by dot product between query and documents in tfidf weighted word vector space.
Closest docs by dot product between query and documents in tfidf weighted word vector space.
[ "Closest", "docs", "by", "dot", "product", "between", "query", "and", "documents", "in", "tfidf", "weighted", "word", "vector", "space", "." ]
def closest_docs(self, query, k=1): """Closest docs by dot product between query and documents in tfidf weighted word vector space. """ spvec = self.text2spvec(query) res = spvec * self.doc_mat if len(res.data) <= k: o_sort = np.argsort(-res.data) els...
[ "def", "closest_docs", "(", "self", ",", "query", ",", "k", "=", "1", ")", ":", "spvec", "=", "self", ".", "text2spvec", "(", "query", ")", "res", "=", "spvec", "*", "self", ".", "doc_mat", "if", "len", "(", "res", ".", "data", ")", "<=", "k", ...
https://github.com/facebookresearch/DrQA/blob/6d7c1b7087b86cfe9bdf84a279adb58dceada3cd/drqa/retriever/tfidf_doc_ranker.py#L55-L70
microsoft/unilm
65f15af2a307ebb64cfb25adf54375b002e6fe8d
xtune/src/transformers/file_utils.py
python
split_s3_path
(url)
return bucket_name, s3_path
Split a full s3 path into the bucket name and path.
Split a full s3 path into the bucket name and path.
[ "Split", "a", "full", "s3", "path", "into", "the", "bucket", "name", "and", "path", "." ]
def split_s3_path(url): """Split a full s3 path into the bucket name and path.""" parsed = urlparse(url) if not parsed.netloc or not parsed.path: raise ValueError("bad s3 path {}".format(url)) bucket_name = parsed.netloc s3_path = parsed.path # Remove '/' at beginning of path. if s3_...
[ "def", "split_s3_path", "(", "url", ")", ":", "parsed", "=", "urlparse", "(", "url", ")", "if", "not", "parsed", ".", "netloc", "or", "not", "parsed", ".", "path", ":", "raise", "ValueError", "(", "\"bad s3 path {}\"", ".", "format", "(", "url", ")", "...
https://github.com/microsoft/unilm/blob/65f15af2a307ebb64cfb25adf54375b002e6fe8d/xtune/src/transformers/file_utils.py#L300-L310
stopstalk/stopstalk-deployment
10c3ab44c4ece33ae515f6888c15033db2004bb1
aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distro.py
python
LinuxDistribution.name
(self, pretty=False)
return name or ''
Return the name of the OS distribution, as a string. For details, see :func:`distro.name`.
Return the name of the OS distribution, as a string.
[ "Return", "the", "name", "of", "the", "OS", "distribution", "as", "a", "string", "." ]
def name(self, pretty=False): """ Return the name of the OS distribution, as a string. For details, see :func:`distro.name`. """ name = self.os_release_attr('name') \ or self.lsb_release_attr('distributor_id') \ or self.distro_release_attr('name') \ ...
[ "def", "name", "(", "self", ",", "pretty", "=", "False", ")", ":", "name", "=", "self", ".", "os_release_attr", "(", "'name'", ")", "or", "self", ".", "lsb_release_attr", "(", "'distributor_id'", ")", "or", "self", ".", "distro_release_attr", "(", "'name'"...
https://github.com/stopstalk/stopstalk-deployment/blob/10c3ab44c4ece33ae515f6888c15033db2004bb1/aws_lambda/spoj_aws_lambda_function/lambda_code/pip/_vendor/distro.py#L706-L725
tensorflow/benchmarks
16af178ad312e8c1213efb27a5f227044228bfdf
scripts/tf_cnn_benchmarks/preprocessing.py
python
parse_example_proto
(example_serialized)
return features['image/encoded'], label, bbox, features['image/class/text']
Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields: image/height: 462 image/width: 581 image/colorspace: 'RGB...
Parses an Example proto containing a training example of an image.
[ "Parses", "an", "Example", "proto", "containing", "a", "training", "example", "of", "an", "image", "." ]
def parse_example_proto(example_serialized): """Parses an Example proto containing a training example of an image. The output of the build_image_data.py image preprocessing script is a dataset containing serialized Example protocol buffers. Each Example proto contains the following fields: image/height: 4...
[ "def", "parse_example_proto", "(", "example_serialized", ")", ":", "# Dense features in Example proto.", "feature_map", "=", "{", "'image/encoded'", ":", "tf", ".", "FixedLenFeature", "(", "[", "]", ",", "dtype", "=", "tf", ".", "string", ",", "default_value", "="...
https://github.com/tensorflow/benchmarks/blob/16af178ad312e8c1213efb27a5f227044228bfdf/scripts/tf_cnn_benchmarks/preprocessing.py#L37-L105
NVIDIA/DeepLearningExamples
589604d49e016cd9ef4525f7abcc9c7b826cfc5e
TensorFlow/Detection/SSD/models/research/object_detection/model_lib.py
python
create_train_and_eval_specs
(train_input_fn, eval_input_fns, eval_on_train_input_fn, predict_input_fn, train_steps, eval_on_train_data=False, final_exporter...
return train_spec, eval_specs
Creates a `TrainSpec` and `EvalSpec`s. Args: train_input_fn: Function that produces features and labels on train data. eval_input_fns: A list of functions that produce features and labels on eval data. eval_on_train_input_fn: Function that produces features and labels for evaluation on train ...
Creates a `TrainSpec` and `EvalSpec`s.
[ "Creates", "a", "TrainSpec", "and", "EvalSpec", "s", "." ]
def create_train_and_eval_specs(train_input_fn, eval_input_fns, eval_on_train_input_fn, predict_input_fn, train_steps, eval_on_train_data=False, ...
[ "def", "create_train_and_eval_specs", "(", "train_input_fn", ",", "eval_input_fns", ",", "eval_on_train_input_fn", ",", "predict_input_fn", ",", "train_steps", ",", "eval_on_train_data", "=", "False", ",", "final_exporter_name", "=", "'Servo'", ",", "eval_spec_names", "="...
https://github.com/NVIDIA/DeepLearningExamples/blob/589604d49e016cd9ef4525f7abcc9c7b826cfc5e/TensorFlow/Detection/SSD/models/research/object_detection/model_lib.py#L674-L733
django-haystack/django-haystack
b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06
haystack/fields.py
python
FloatField.convert
(self, value)
return float(value)
[]
def convert(self, value): if value is None: return None return float(value)
[ "def", "convert", "(", "self", ",", "value", ")", ":", "if", "value", "is", "None", ":", "return", "None", "return", "float", "(", "value", ")" ]
https://github.com/django-haystack/django-haystack/blob/b6dd72e6b5c97b782f5436b7bb4e8227ba6e3b06/haystack/fields.py#L332-L336
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/tkinter/tix.py
python
Meter.__init__
(self, master=None, cnf={}, **kw)
[]
def __init__(self, master=None, cnf={}, **kw): TixWidget.__init__(self, master, 'tixMeter', ['options'], cnf, kw)
[ "def", "__init__", "(", "self", ",", "master", "=", "None", ",", "cnf", "=", "{", "}", ",", "*", "*", "kw", ")", ":", "TixWidget", ".", "__init__", "(", "self", ",", "master", ",", "'tixMeter'", ",", "[", "'options'", "]", ",", "cnf", ",", "kw", ...
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/tkinter/tix.py#L1130-L1132