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
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backends/qt_editor/figureoptions.py
python
figure_edit
(axes, parent=None)
Edit matplotlib figure options
Edit matplotlib figure options
[ "Edit", "matplotlib", "figure", "options" ]
def figure_edit(axes, parent=None): """Edit matplotlib figure options""" sep = (None, None) # separator # Get / General # Cast to builtin floats as they have nicer reprs. xmin, xmax = map(float, axes.get_xlim()) ymin, ymax = map(float, axes.get_ylim()) general = [('Title', axes.get_title()...
[ "def", "figure_edit", "(", "axes", ",", "parent", "=", "None", ")", ":", "sep", "=", "(", "None", ",", "None", ")", "# separator", "# Get / General", "# Cast to builtin floats as they have nicer reprs.", "xmin", ",", "xmax", "=", "map", "(", "float", ",", "axe...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/site-packages/matplotlib-3.0.3-py3.7-macosx-10.9-x86_64.egg/matplotlib/backends/qt_editor/figureoptions.py#L38-L257
nubank/fklearn
aa558fbce8aa10a20f1043c6b9954dec85800ddd
src/fklearn/training/unsupervised.py
python
isolation_forest_learner
(df: pd.DataFrame, features: List[str], params: Dict[str, Any] = None, prediction_column: str = "prediction", encode_extra_cols: bool = True)
return p, p(df), log
Fits an anomaly detection algorithm (Isolation Forest) to the dataset Parameters ---------- df : pandas.DataFrame A Pandas' DataFrame with features and target columns. The model will be trained to predict the target column from the features. features : list of str A lis...
Fits an anomaly detection algorithm (Isolation Forest) to the dataset
[ "Fits", "an", "anomaly", "detection", "algorithm", "(", "Isolation", "Forest", ")", "to", "the", "dataset" ]
def isolation_forest_learner(df: pd.DataFrame, features: List[str], params: Dict[str, Any] = None, prediction_column: str = "prediction", encode_extra_cols: bool = True) -> LearnerReturnType: """ ...
[ "def", "isolation_forest_learner", "(", "df", ":", "pd", ".", "DataFrame", ",", "features", ":", "List", "[", "str", "]", ",", "params", ":", "Dict", "[", "str", ",", "Any", "]", "=", "None", ",", "prediction_column", ":", "str", "=", "\"prediction\"", ...
https://github.com/nubank/fklearn/blob/aa558fbce8aa10a20f1043c6b9954dec85800ddd/src/fklearn/training/unsupervised.py#L15-L70
apache/bloodhound
c3e31294e68af99d4e040e64fbdf52394344df9e
trac/tracopt/versioncontrol/svn/svn_fs.py
python
SubversionRepository.get_path_url
(self, path, rev)
Retrieve the "native" URL from which this repository is reachable from Subversion clients.
Retrieve the "native" URL from which this repository is reachable from Subversion clients.
[ "Retrieve", "the", "native", "URL", "from", "which", "this", "repository", "is", "reachable", "from", "Subversion", "clients", "." ]
def get_path_url(self, path, rev): """Retrieve the "native" URL from which this repository is reachable from Subversion clients. """ url = self.params.get('url', '').rstrip('/') if url: if not path or path == '/': return url return url + '/...
[ "def", "get_path_url", "(", "self", ",", "path", ",", "rev", ")", ":", "url", "=", "self", ".", "params", ".", "get", "(", "'url'", ",", "''", ")", ".", "rstrip", "(", "'/'", ")", "if", "url", ":", "if", "not", "path", "or", "path", "==", "'/'"...
https://github.com/apache/bloodhound/blob/c3e31294e68af99d4e040e64fbdf52394344df9e/trac/tracopt/versioncontrol/svn/svn_fs.py#L453-L461
JiYou/openstack
8607dd488bde0905044b303eb6e52bdea6806923
packages/source/nova/nova/availability_zones.py
python
get_availability_zones
(context)
return (available_zones, not_available_zones)
Return available and unavailable zones.
Return available and unavailable zones.
[ "Return", "available", "and", "unavailable", "zones", "." ]
def get_availability_zones(context): """Return available and unavailable zones.""" enabled_services = db.service_get_all(context, False) disabled_services = db.service_get_all(context, True) enabled_services = set_availability_zones(context, enabled_services) disabled_services = set_availability_zon...
[ "def", "get_availability_zones", "(", "context", ")", ":", "enabled_services", "=", "db", ".", "service_get_all", "(", "context", ",", "False", ")", "disabled_services", "=", "db", ".", "service_get_all", "(", "context", ",", "True", ")", "enabled_services", "="...
https://github.com/JiYou/openstack/blob/8607dd488bde0905044b303eb6e52bdea6806923/packages/source/nova/nova/availability_zones.py#L69-L88
filipradenovic/cnnimageretrieval-pytorch
c5368dfbbfe0286f536e374a4a35ff89578ef2e5
cirtorch/utils/download.py
python
download_train
(data_dir)
DOWNLOAD_TRAIN Checks, and, if required, downloads the necessary datasets for the training. download_train(DATA_ROOT) checks if the data necessary for running the example script exist. If not it downloads it in the folder structure: DATA_ROOT/train/retrieval-SfM-120k/ : folder with r...
DOWNLOAD_TRAIN Checks, and, if required, downloads the necessary datasets for the training. download_train(DATA_ROOT) checks if the data necessary for running the example script exist. If not it downloads it in the folder structure: DATA_ROOT/train/retrieval-SfM-120k/ : folder with r...
[ "DOWNLOAD_TRAIN", "Checks", "and", "if", "required", "downloads", "the", "necessary", "datasets", "for", "the", "training", ".", "download_train", "(", "DATA_ROOT", ")", "checks", "if", "the", "data", "necessary", "for", "running", "the", "example", "script", "e...
def download_train(data_dir): """ DOWNLOAD_TRAIN Checks, and, if required, downloads the necessary datasets for the training. download_train(DATA_ROOT) checks if the data necessary for running the example script exist. If not it downloads it in the folder structure: DATA_ROOT/...
[ "def", "download_train", "(", "data_dir", ")", ":", "# Create data folder if it does not exist", "if", "not", "os", ".", "path", ".", "isdir", "(", "data_dir", ")", ":", "os", ".", "mkdir", "(", "data_dir", ")", "# Create datasets folder if it does not exist", "data...
https://github.com/filipradenovic/cnnimageretrieval-pytorch/blob/c5368dfbbfe0286f536e374a4a35ff89578ef2e5/cirtorch/utils/download.py#L90-L152
nltk/nltk_contrib
c9da2c29777ca9df650740145f1f4a375ccac961
nltk_contrib/hadoop/hadooplib/mapper.py
python
MapperBase.__init__
(self)
set the default input formatter and output collector
set the default input formatter and output collector
[ "set", "the", "default", "input", "formatter", "and", "output", "collector" ]
def __init__(self): """ set the default input formatter and output collector """ self.inputformat = TextLineInput self.outputcollector = LineOutput
[ "def", "__init__", "(", "self", ")", ":", "self", ".", "inputformat", "=", "TextLineInput", "self", ".", "outputcollector", "=", "LineOutput" ]
https://github.com/nltk/nltk_contrib/blob/c9da2c29777ca9df650740145f1f4a375ccac961/nltk_contrib/hadoop/hadooplib/mapper.py#L13-L18
Blizzard/s2protocol
4bfe857bb832eee12cc6307dd699e3b74bd7e1b2
s2protocol/versions/protocol28272.py
python
decode_replay_details
(contents)
return decoder.instance(game_details_typeid)
Decodes and returns the game details from the contents byte string.
Decodes and returns the game details from the contents byte string.
[ "Decodes", "and", "returns", "the", "game", "details", "from", "the", "contents", "byte", "string", "." ]
def decode_replay_details(contents): """Decodes and returns the game details from the contents byte string.""" decoder = VersionedDecoder(contents, typeinfos) return decoder.instance(game_details_typeid)
[ "def", "decode_replay_details", "(", "contents", ")", ":", "decoder", "=", "VersionedDecoder", "(", "contents", ",", "typeinfos", ")", "return", "decoder", ".", "instance", "(", "game_details_typeid", ")" ]
https://github.com/Blizzard/s2protocol/blob/4bfe857bb832eee12cc6307dd699e3b74bd7e1b2/s2protocol/versions/protocol28272.py#L428-L431
oracle/oci-python-sdk
3c1604e4e212008fb6718e2f68cdb5ef71fd5793
src/oci/data_catalog/data_catalog_client.py
python
DataCatalogClient.get_term
(self, catalog_id, glossary_key, term_key, **kwargs)
Gets a specific glossary term by key. :param str catalog_id: (required) Unique catalog identifier. :param str glossary_key: (required) Unique glossary key. :param str term_key: (required) Unique glossary term key. :param list[str] fields: (optiona...
Gets a specific glossary term by key.
[ "Gets", "a", "specific", "glossary", "term", "by", "key", "." ]
def get_term(self, catalog_id, glossary_key, term_key, **kwargs): """ Gets a specific glossary term by key. :param str catalog_id: (required) Unique catalog identifier. :param str glossary_key: (required) Unique glossary key. :param str term_key: (requ...
[ "def", "get_term", "(", "self", ",", "catalog_id", ",", "glossary_key", ",", "term_key", ",", "*", "*", "kwargs", ")", ":", "resource_path", "=", "\"/catalogs/{catalogId}/glossaries/{glossaryKey}/terms/{termKey}\"", "method", "=", "\"GET\"", "# Don't accept unknown kwargs...
https://github.com/oracle/oci-python-sdk/blob/3c1604e4e212008fb6718e2f68cdb5ef71fd5793/src/oci/data_catalog/data_catalog_client.py#L7181-L7289
MillionIntegrals/vel
f3ce7da64362ad207f40f2c0d58d9300a25df3e8
vel/rl/buffers/circular_replay_buffer.py
python
CircularReplayBuffer.store_transition
(self, frame, action, reward, done, extra_info=None)
Store given transition in the backend
Store given transition in the backend
[ "Store", "given", "transition", "in", "the", "backend" ]
def store_transition(self, frame, action, reward, done, extra_info=None): """ Store given transition in the backend """ self.backend.store_transition(frame=frame, action=action, reward=reward, done=done, extra_info=extra_info)
[ "def", "store_transition", "(", "self", ",", "frame", ",", "action", ",", "reward", ",", "done", ",", "extra_info", "=", "None", ")", ":", "self", ".", "backend", ".", "store_transition", "(", "frame", "=", "frame", ",", "action", "=", "action", ",", "...
https://github.com/MillionIntegrals/vel/blob/f3ce7da64362ad207f40f2c0d58d9300a25df3e8/vel/rl/buffers/circular_replay_buffer.py#L103-L105
deepmind/dm_control
806a10e896e7c887635328bfa8352604ad0fedae
dm_control/suite/wrappers/pixels.py
python
Wrapper.reset
(self)
return self._add_pixel_observation(time_step)
[]
def reset(self): time_step = self._env.reset() return self._add_pixel_observation(time_step)
[ "def", "reset", "(", "self", ")", ":", "time_step", "=", "self", ".", "_env", ".", "reset", "(", ")", "return", "self", ".", "_add_pixel_observation", "(", "time_step", ")" ]
https://github.com/deepmind/dm_control/blob/806a10e896e7c887635328bfa8352604ad0fedae/dm_control/suite/wrappers/pixels.py#L87-L89
cisco/mindmeld
809c36112e9ea8019fe29d54d136ca14eb4fd8db
mindmeld/components/nlp.py
python
Processor._build_recursive
(self, incremental=False, label_set=None)
Builds all the natural language processing models for this processor and its children. Args: incremental (bool, optional): When ``True``, only build models whose training data or configuration has changed since the last build. Defaults to ``False``. label_set (string, op...
Builds all the natural language processing models for this processor and its children.
[ "Builds", "all", "the", "natural", "language", "processing", "models", "for", "this", "processor", "and", "its", "children", "." ]
def _build_recursive(self, incremental=False, label_set=None): """Builds all the natural language processing models for this processor and its children. Args: incremental (bool, optional): When ``True``, only build models whose training data or configuration has changed sinc...
[ "def", "_build_recursive", "(", "self", ",", "incremental", "=", "False", ",", "label_set", "=", "None", ")", ":", "self", ".", "_build", "(", "incremental", "=", "incremental", ",", "label_set", "=", "label_set", ",", "load_cached", "=", "False", ")", "# ...
https://github.com/cisco/mindmeld/blob/809c36112e9ea8019fe29d54d136ca14eb4fd8db/mindmeld/components/nlp.py#L148-L165
OpenXenManager/openxenmanager
1cb5c1cb13358ba584856e99a94f9669d17670ff
src/pygtk_chart/chart_object.py
python
ChartObject._do_draw
(self, context, rect)
A derived class should override this method. The drawing stuff should happen here. @type context: cairo.Context @param context: The context to draw on. @type rect: gtk.gdk.Rectangle @param rect: A rectangle representing the charts area.
A derived class should override this method. The drawing stuff should happen here.
[ "A", "derived", "class", "should", "override", "this", "method", ".", "The", "drawing", "stuff", "should", "happen", "here", "." ]
def _do_draw(self, context, rect): """ A derived class should override this method. The drawing stuff should happen here. @type context: cairo.Context @param context: The context to draw on. @type rect: gtk.gdk.Rectangle @param rect: A rectangle represent...
[ "def", "_do_draw", "(", "self", ",", "context", ",", "rect", ")", ":", "pass" ]
https://github.com/OpenXenManager/openxenmanager/blob/1cb5c1cb13358ba584856e99a94f9669d17670ff/src/pygtk_chart/chart_object.py#L85-L95
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/lib/python2.7/site-packages/whoosh/searching.py
python
Results.upgrade
(self, results, reverse=False)
Re-sorts the results so any hits that are also in 'results' appear before hits not in 'results', otherwise keeping their current relative positions. This does not add the documents in the other results object to this one. :param results: another results object. :param reverse: i...
Re-sorts the results so any hits that are also in 'results' appear before hits not in 'results', otherwise keeping their current relative positions. This does not add the documents in the other results object to this one.
[ "Re", "-", "sorts", "the", "results", "so", "any", "hits", "that", "are", "also", "in", "results", "appear", "before", "hits", "not", "in", "results", "otherwise", "keeping", "their", "current", "relative", "positions", ".", "This", "does", "not", "add", "...
def upgrade(self, results, reverse=False): """Re-sorts the results so any hits that are also in 'results' appear before hits not in 'results', otherwise keeping their current relative positions. This does not add the documents in the other results object to this one. :param resu...
[ "def", "upgrade", "(", "self", ",", "results", ",", "reverse", "=", "False", ")", ":", "if", "not", "len", "(", "results", ")", ":", "return", "otherdocs", "=", "results", ".", "docs", "(", ")", "arein", "=", "[", "item", "for", "item", "in", "self...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/lib/python2.7/site-packages/whoosh/searching.py#L1301-L1324
matplotlib/matplotlib
8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322
lib/matplotlib/textpath.py
python
TextToPath.get_text_path
(self, prop, s, ismath=False)
return verts, codes
Convert text *s* to path (a tuple of vertices and codes for matplotlib.path.Path). Parameters ---------- prop : `~matplotlib.font_manager.FontProperties` The font properties for the text. s : str The text to be converted. ismath : {False, True, ...
Convert text *s* to path (a tuple of vertices and codes for matplotlib.path.Path).
[ "Convert", "text", "*", "s", "*", "to", "path", "(", "a", "tuple", "of", "vertices", "and", "codes", "for", "matplotlib", ".", "path", ".", "Path", ")", "." ]
def get_text_path(self, prop, s, ismath=False): """ Convert text *s* to path (a tuple of vertices and codes for matplotlib.path.Path). Parameters ---------- prop : `~matplotlib.font_manager.FontProperties` The font properties for the text. s : str ...
[ "def", "get_text_path", "(", "self", ",", "prop", ",", "s", ",", "ismath", "=", "False", ")", ":", "if", "ismath", "==", "\"TeX\"", ":", "glyph_info", ",", "glyph_map", ",", "rects", "=", "self", ".", "get_glyphs_tex", "(", "prop", ",", "s", ")", "el...
https://github.com/matplotlib/matplotlib/blob/8d7a2b9d2a38f01ee0d6802dd4f9e98aec812322/lib/matplotlib/textpath.py#L73-L134
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python3-alpha/python-libs/pyxmpp2/ext/disco.py
python
DiscoInfo.get_identities
(self)
return ret
List the identity objects contained in `self`. :return: the list of identities. :returntype: `list` of `DiscoIdentity`
List the identity objects contained in `self`.
[ "List", "the", "identity", "objects", "contained", "in", "self", "." ]
def get_identities(self): """List the identity objects contained in `self`. :return: the list of identities. :returntype: `list` of `DiscoIdentity`""" ret=[] l=self.xpath_ctxt.xpathEval("d:identity") if l is not None: for i in l: ret.append(Di...
[ "def", "get_identities", "(", "self", ")", ":", "ret", "=", "[", "]", "l", "=", "self", ".", "xpath_ctxt", ".", "xpathEval", "(", "\"d:identity\"", ")", "if", "l", "is", "not", "None", ":", "for", "i", "in", "l", ":", "ret", ".", "append", "(", "...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/pyxmpp2/ext/disco.py#L723-L733
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/rings/number_field/totallyreal_phc.py
python
__lagrange_bounds_phc
(n, m, a, tmpfile=None)
r""" This function determines the bounds on the roots in the enumeration of totally real fields via Lagrange multipliers. It is used internally by the main function enumerate_totallyreal_fields_prim(), which should be consulted for further information. INPUT: - k -- integer, the index of ...
r""" This function determines the bounds on the roots in the enumeration of totally real fields via Lagrange multipliers.
[ "r", "This", "function", "determines", "the", "bounds", "on", "the", "roots", "in", "the", "enumeration", "of", "totally", "real", "fields", "via", "Lagrange", "multipliers", "." ]
def __lagrange_bounds_phc(n, m, a, tmpfile=None): r""" This function determines the bounds on the roots in the enumeration of totally real fields via Lagrange multipliers. It is used internally by the main function enumerate_totallyreal_fields_prim(), which should be consulted for further infor...
[ "def", "__lagrange_bounds_phc", "(", "n", ",", "m", ",", "a", ",", "tmpfile", "=", "None", ")", ":", "# Compute power sums.", "S", "=", "coefficients_to_power_sums", "(", "n", ",", "m", ",", "a", ")", "# Look for phc.", "fi", ",", "fo", "=", "os", ".", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/rings/number_field/totallyreal_phc.py#L61-L155
dimagi/commcare-hq
d67ff1d3b4c51fa050c19e60c3253a79d3452a39
corehq/apps/hqmedia/views.py
python
ProcessBulkUploadView.validate_file
(self, replace_diff_ext=False)
[]
def validate_file(self, replace_diff_ext=False): if not self.mime_type in self.valid_mime_types(): raise BadMediaFileException(_("Uploaded file is not a ZIP file.")) if not self.uploaded_zip: raise BadMediaFileException(_("There is no ZIP file.")) if self.uploaded_zip.tes...
[ "def", "validate_file", "(", "self", ",", "replace_diff_ext", "=", "False", ")", ":", "if", "not", "self", ".", "mime_type", "in", "self", ".", "valid_mime_types", "(", ")", ":", "raise", "BadMediaFileException", "(", "_", "(", "\"Uploaded file is not a ZIP file...
https://github.com/dimagi/commcare-hq/blob/d67ff1d3b4c51fa050c19e60c3253a79d3452a39/corehq/apps/hqmedia/views.py#L568-L574
eternnoir/pyTelegramBotAPI
fdbc0e6a619f671c2ac97afa2f694c17c6dce7d9
telebot/__init__.py
python
TeleBot.send_audio
( self, chat_id: Union[int, str], audio: Union[Any, str], caption: Optional[str]=None, duration: Optional[int]=None, performer: Optional[str]=None, title: Optional[str]=None, reply_to_message_id: Optional[int]=None, reply_markup: Optional[REPLY_MARKUP_TYPES...
return types.Message.de_json( apihelper.send_audio( self.token, chat_id, audio, caption, duration, performer, title, reply_to_message_id, reply_markup, parse_mode, disable_notification, timeout, thumb, caption_entities, allow_sending_without_reply, protect_con...
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. :param chat_id:Unique identifier for the message recipient :param audio:Audio file to send. :param caption: :param duration:Duration of th...
Use this method to send audio files, if you want Telegram clients to display them in the music player. Your audio must be in the .mp3 format. :param chat_id:Unique identifier for the message recipient :param audio:Audio file to send. :param caption: :param duration:Duration of th...
[ "Use", "this", "method", "to", "send", "audio", "files", "if", "you", "want", "Telegram", "clients", "to", "display", "them", "in", "the", "music", "player", ".", "Your", "audio", "must", "be", "in", "the", ".", "mp3", "format", ".", ":", "param", "cha...
def send_audio( self, chat_id: Union[int, str], audio: Union[Any, str], caption: Optional[str]=None, duration: Optional[int]=None, performer: Optional[str]=None, title: Optional[str]=None, reply_to_message_id: Optional[int]=None, reply_markup: Optional[REPL...
[ "def", "send_audio", "(", "self", ",", "chat_id", ":", "Union", "[", "int", ",", "str", "]", ",", "audio", ":", "Union", "[", "Any", ",", "str", "]", ",", "caption", ":", "Optional", "[", "str", "]", "=", "None", ",", "duration", ":", "Optional", ...
https://github.com/eternnoir/pyTelegramBotAPI/blob/fdbc0e6a619f671c2ac97afa2f694c17c6dce7d9/telebot/__init__.py#L1100-L1139
kedro-org/kedro
e78990c6b606a27830f0d502afa0f639c0830950
kedro/extras/datasets/pandas/parquet_dataset.py
python
ParquetDataSet.__init__
( self, filepath: str, load_args: Dict[str, Any] = None, save_args: Dict[str, Any] = None, version: Version = None, credentials: Dict[str, Any] = None, fs_args: Dict[str, Any] = None, )
Creates a new instance of ``ParquetDataSet`` pointing to a concrete Parquet file on a specific filesystem. Args: filepath: Filepath in POSIX format to a Parquet file prefixed with a protocol like `s3://`. If prefix is not provided, `file` protocol (local filesystem) will be ...
Creates a new instance of ``ParquetDataSet`` pointing to a concrete Parquet file on a specific filesystem.
[ "Creates", "a", "new", "instance", "of", "ParquetDataSet", "pointing", "to", "a", "concrete", "Parquet", "file", "on", "a", "specific", "filesystem", "." ]
def __init__( self, filepath: str, load_args: Dict[str, Any] = None, save_args: Dict[str, Any] = None, version: Version = None, credentials: Dict[str, Any] = None, fs_args: Dict[str, Any] = None, ) -> None: """Creates a new instance of ``ParquetDataSet...
[ "def", "__init__", "(", "self", ",", "filepath", ":", "str", ",", "load_args", ":", "Dict", "[", "str", ",", "Any", "]", "=", "None", ",", "save_args", ":", "Dict", "[", "str", ",", "Any", "]", "=", "None", ",", "version", ":", "Version", "=", "N...
https://github.com/kedro-org/kedro/blob/e78990c6b606a27830f0d502afa0f639c0830950/kedro/extras/datasets/pandas/parquet_dataset.py#L76-L150
Azure/azure-functions-python-worker
edc21f8c6214d2072944ed45d6eb5016e2c747fd
azure_functions_worker/utils/dependency.py
python
DependencyManager._remove_module_cache
(path: str)
Remove module cache if the module is imported from specific path. This will not impact builtin modules Parameters ---------- path: str The module cache to be removed if it is imported from this path.
Remove module cache if the module is imported from specific path. This will not impact builtin modules
[ "Remove", "module", "cache", "if", "the", "module", "is", "imported", "from", "specific", "path", ".", "This", "will", "not", "impact", "builtin", "modules" ]
def _remove_module_cache(path: str): """Remove module cache if the module is imported from specific path. This will not impact builtin modules Parameters ---------- path: str The module cache to be removed if it is imported from this path. """ if not ...
[ "def", "_remove_module_cache", "(", "path", ":", "str", ")", ":", "if", "not", "path", ":", "return", "not_builtin", "=", "set", "(", "sys", ".", "modules", ".", "keys", "(", ")", ")", "-", "set", "(", "sys", ".", "builtin_module_names", ")", "# Don't ...
https://github.com/Azure/azure-functions-python-worker/blob/edc21f8c6214d2072944ed45d6eb5016e2c747fd/azure_functions_worker/utils/dependency.py#L356-L395
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/UserString.py
python
UserString.__str__
(self)
return str(self.data)
[]
def __str__(self): return str(self.data)
[ "def", "__str__", "(", "self", ")", ":", "return", "str", "(", "self", ".", "data", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/UserString.py#L21-L21
nilearn/nilearn
9edba4471747efacf21260bf470a346307f52706
nilearn/_utils/class_inspect.py
python
get_params
(cls, instance, ignore=None)
return params
Retrieve the initialization parameters corresponding to a class This helper function retrieves the parameters of function __init__ for class 'cls' and returns the value for these parameters in object 'instance'. When using a composition pattern (e.g. with a NiftiMasker class), it is useful to forward p...
Retrieve the initialization parameters corresponding to a class
[ "Retrieve", "the", "initialization", "parameters", "corresponding", "to", "a", "class" ]
def get_params(cls, instance, ignore=None): """Retrieve the initialization parameters corresponding to a class This helper function retrieves the parameters of function __init__ for class 'cls' and returns the value for these parameters in object 'instance'. When using a composition pattern (e.g. with ...
[ "def", "get_params", "(", "cls", ",", "instance", ",", "ignore", "=", "None", ")", ":", "_ignore", "=", "set", "(", "(", "'memory'", ",", "'memory_level'", ",", "'verbose'", ",", "'copy'", ",", "'n_jobs'", ")", ")", "if", "ignore", "is", "not", "None",...
https://github.com/nilearn/nilearn/blob/9edba4471747efacf21260bf470a346307f52706/nilearn/_utils/class_inspect.py#L10-L48
reuterbal/photobooth
40f1cdadcc8cff0c142fe1d4f14813f07c5a656f
photobooth/worker/PictureMailer.py
python
send_mail
(send_from, send_to, subject, message, picture, filename, server, port, is_auth, username, password, is_tls)
Compose and send email with provided info and attachments. Based on https://stackoverflow.com/a/16509278 Args: send_from (str): from name send_to (str): to name subject (str): message title message (str): message body picture (jpg byte_data): ByteIO data of the JPG pict...
Compose and send email with provided info and attachments.
[ "Compose", "and", "send", "email", "with", "provided", "info", "and", "attachments", "." ]
def send_mail(send_from, send_to, subject, message, picture, filename, server, port, is_auth, username, password, is_tls): """Compose and send email with provided info and attachments. Based on https://stackoverflow.com/a/16509278 Args: send_from (str): from name send_to (str...
[ "def", "send_mail", "(", "send_from", ",", "send_to", ",", "subject", ",", "message", ",", "picture", ",", "filename", ",", "server", ",", "port", ",", "is_auth", ",", "username", ",", "password", ",", "is_tls", ")", ":", "msg", "=", "MIMEMultipart", "("...
https://github.com/reuterbal/photobooth/blob/40f1cdadcc8cff0c142fe1d4f14813f07c5a656f/photobooth/worker/PictureMailer.py#L34-L75
GoSecure/pyrdp
abd8b8762b6d7fd0e49d4a927b529f892b412743
pyrdp/parser/rdp/connection.py
python
ServerConnectionParser.__init__
(self)
[]
def __init__(self): super().__init__() self.parsers = { ConnectionDataType.SERVER_CORE: self.parseServerCoreData, ConnectionDataType.SERVER_NETWORK: self.parseServerNetworkData, ConnectionDataType.SERVER_SECURITY: self.parseServerSecurityData, } self....
[ "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "parsers", "=", "{", "ConnectionDataType", ".", "SERVER_CORE", ":", "self", ".", "parseServerCoreData", ",", "ConnectionDataType", ".", "SERVER_NETWORK", ":"...
https://github.com/GoSecure/pyrdp/blob/abd8b8762b6d7fd0e49d4a927b529f892b412743/pyrdp/parser/rdp/connection.py#L258-L270
roclark/sportsipy
c19f545d3376d62ded6304b137dc69238ac620a9
sportsipy/fb/roster.py
python
Roster.__repr__
(self)
return self.__str__()
Return the string representation of the class.
Return the string representation of the class.
[ "Return", "the", "string", "representation", "of", "the", "class", "." ]
def __repr__(self): """ Return the string representation of the class. """ return self.__str__()
[ "def", "__repr__", "(", "self", ")", ":", "return", "self", ".", "__str__", "(", ")" ]
https://github.com/roclark/sportsipy/blob/c19f545d3376d62ded6304b137dc69238ac620a9/sportsipy/fb/roster.py#L1541-L1545
twisted/twisted
dee676b040dd38b847ea6fb112a712cb5e119490
src/twisted/spread/pb.py
python
Broker.sendDecRef
(self, objectID)
(internal) Send a DECREF directive. @param objectID: The object ID.
(internal) Send a DECREF directive.
[ "(", "internal", ")", "Send", "a", "DECREF", "directive", "." ]
def sendDecRef(self, objectID): """ (internal) Send a DECREF directive. @param objectID: The object ID. """ self.sendCall(b"decref", objectID)
[ "def", "sendDecRef", "(", "self", ",", "objectID", ")", ":", "self", ".", "sendCall", "(", "b\"decref\"", ",", "objectID", ")" ]
https://github.com/twisted/twisted/blob/dee676b040dd38b847ea6fb112a712cb5e119490/src/twisted/spread/pb.py#L1165-L1171
pythonarcade/arcade
1ee3eb1900683213e8e8df93943327c2ea784564
arcade/examples/sprite_properties.py
python
main
()
Main function
Main function
[ "Main", "function" ]
def main(): """ Main function """ window = MyGame() window.setup() arcade.run()
[ "def", "main", "(", ")", ":", "window", "=", "MyGame", "(", ")", "window", ".", "setup", "(", ")", "arcade", ".", "run", "(", ")" ]
https://github.com/pythonarcade/arcade/blob/1ee3eb1900683213e8e8df93943327c2ea784564/arcade/examples/sprite_properties.py#L129-L133
aws/aws-parallelcluster
f1fe5679a01c524e7ea904c329bd6d17318c6cd9
api/client/src/pcluster_client/model/build_image_request_content.py
python
BuildImageRequestContent.openapi_types
()
return { 'image_configuration': (str,), # noqa: E501 'image_id': (str,), # noqa: E501 }
This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type.
This must be a method because a model may have properties that are of type self, this must run after the class is loaded
[ "This", "must", "be", "a", "method", "because", "a", "model", "may", "have", "properties", "that", "are", "of", "type", "self", "this", "must", "run", "after", "the", "class", "is", "loaded" ]
def openapi_types(): """ This must be a method because a model may have properties that are of type self, this must run after the class is loaded Returns openapi_types (dict): The key is attribute name and the value is attribute type. """ retu...
[ "def", "openapi_types", "(", ")", ":", "return", "{", "'image_configuration'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "'image_id'", ":", "(", "str", ",", ")", ",", "# noqa: E501", "}" ]
https://github.com/aws/aws-parallelcluster/blob/f1fe5679a01c524e7ea904c329bd6d17318c6cd9/api/client/src/pcluster_client/model/build_image_request_content.py#L70-L82
plasticityai/supersqlite
d74da749c6fa5df021df3968b854b9a59f829e17
supersqlite/third_party/_apsw/tools/shell.py
python
Shell._set_db
(self, newv)
Sets the open database (or None) and filename
Sets the open database (or None) and filename
[ "Sets", "the", "open", "database", "(", "or", "None", ")", "and", "filename" ]
def _set_db(self, newv): "Sets the open database (or None) and filename" (db, dbfilename)=newv if self._db: self._db.close(True) self._db=None self._db=db self.dbfilename=dbfilename
[ "def", "_set_db", "(", "self", ",", "newv", ")", ":", "(", "db", ",", "dbfilename", ")", "=", "newv", "if", "self", ".", "_db", ":", "self", ".", "_db", ".", "close", "(", "True", ")", "self", ".", "_db", "=", "None", "self", ".", "_db", "=", ...
https://github.com/plasticityai/supersqlite/blob/d74da749c6fa5df021df3968b854b9a59f829e17/supersqlite/third_party/_apsw/tools/shell.py#L160-L167
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/asyncio/transports.py
python
WriteTransport.abort
(self)
Close the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument.
Close the transport immediately.
[ "Close", "the", "transport", "immediately", "." ]
def abort(self): """Close the transport immediately. Buffered data will be lost. No more data will be received. The protocol's connection_lost() method will (eventually) be called with None as its argument. """ raise NotImplementedError
[ "def", "abort", "(", "self", ")", ":", "raise", "NotImplementedError" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/asyncio/transports.py#L132-L139
intuition-io/intuition
cd517e6b3b315a743eb4d0d0dc294e264ab913ce
intuition/api/algorithm.py
python
TradingFactory.warm
(self, data)
Called at the first handle_data frame
Called at the first handle_data frame
[ "Called", "at", "the", "first", "handle_data", "frame" ]
def warm(self, data): ''' Called at the first handle_data frame ''' pass
[ "def", "warm", "(", "self", ",", "data", ")", ":", "pass" ]
https://github.com/intuition-io/intuition/blob/cd517e6b3b315a743eb4d0d0dc294e264ab913ce/intuition/api/algorithm.py#L64-L66
WerWolv/EdiZon_CheatsConfigsAndScripts
d16d36c7509c01dca770f402babd83ff2e9ae6e7
Scripts/lib/python3.5/mailbox.py
python
Mailbox.iteritems
(self)
Return an iterator over (key, message) tuples.
Return an iterator over (key, message) tuples.
[ "Return", "an", "iterator", "over", "(", "key", "message", ")", "tuples", "." ]
def iteritems(self): """Return an iterator over (key, message) tuples.""" for key in self.iterkeys(): try: value = self[key] except KeyError: continue yield (key, value)
[ "def", "iteritems", "(", "self", ")", ":", "for", "key", "in", "self", ".", "iterkeys", "(", ")", ":", "try", ":", "value", "=", "self", "[", "key", "]", "except", "KeyError", ":", "continue", "yield", "(", "key", ",", "value", ")" ]
https://github.com/WerWolv/EdiZon_CheatsConfigsAndScripts/blob/d16d36c7509c01dca770f402babd83ff2e9ae6e7/Scripts/lib/python3.5/mailbox.py#L120-L127
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python3-alpha/python-libs/pyxmpp2/exceptions.py
python
ProtocolError.log_ignored
(self)
Log message via the "pyxmpp.ProtocolError.ignored" logger.
Log message via the "pyxmpp.ProtocolError.ignored" logger.
[ "Log", "message", "via", "the", "pyxmpp", ".", "ProtocolError", ".", "ignored", "logger", "." ]
def log_ignored(self): """Log message via the "pyxmpp.ProtocolError.ignored" logger.""" self.logger_ignored.debug("Protocol error detected: {0}" .format(self.message))
[ "def", "log_ignored", "(", "self", ")", ":", "self", ".", "logger_ignored", ".", "debug", "(", "\"Protocol error detected: {0}\"", ".", "format", "(", "self", ".", "message", ")", ")" ]
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python3-alpha/python-libs/pyxmpp2/exceptions.py#L173-L176
datacenter/nexus9000
73b2540db588e60bba79a95b5b0e7d6ea00024c6
nexusdash/utils/fetchcliout.py
python
FetchCliOut.__init__
(self, target_url, username, password, **kwargs)
@param target_url: URL format. For telnet/ssh use, telnet://hostip:port or ssh://hostip:port For NXAPI, use http://hostip/ins @param username: Username of device @param password: Password of device
[]
def __init__(self, target_url, username, password, **kwargs): ''' @param target_url: URL format. For telnet/ssh use, telnet://hostip:port or ssh://hostip:port For NXAPI, use http://hostip/ins @param username: Username of device @param password: Pass...
[ "def", "__init__", "(", "self", ",", "target_url", ",", "username", ",", "password", ",", "*", "*", "kwargs", ")", ":", "self", ".", "username", "=", "username", "self", ".", "password", "=", "password", "self", ".", "target_url", "=", "target_url", "par...
https://github.com/datacenter/nexus9000/blob/73b2540db588e60bba79a95b5b0e7d6ea00024c6/nexusdash/utils/fetchcliout.py#L19-L37
aws-samples/aws-kube-codesuite
ab4e5ce45416b83bffb947ab8d234df5437f4fca
src/setuptools/__init__.py
python
PackageFinder._find_packages_iter
(cls, where, exclude, include)
All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter.
All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter.
[ "All", "the", "packages", "found", "in", "where", "that", "pass", "the", "include", "filter", "but", "not", "the", "exclude", "filter", "." ]
def _find_packages_iter(cls, where, exclude, include): """ All the packages found in 'where' that pass the 'include' filter, but not the 'exclude' filter. """ for root, dirs, files in os.walk(where, followlinks=True): # Copy dirs to iterate over it, then empty dirs. ...
[ "def", "_find_packages_iter", "(", "cls", ",", "where", ",", "exclude", ",", "include", ")", ":", "for", "root", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "where", ",", "followlinks", "=", "True", ")", ":", "# Copy dirs to iterate over it, t...
https://github.com/aws-samples/aws-kube-codesuite/blob/ab4e5ce45416b83bffb947ab8d234df5437f4fca/src/setuptools/__init__.py#L63-L88
rembo10/headphones
b3199605be1ebc83a7a8feab6b1e99b64014187c
lib/munkres.py
python
Munkres.__convert_path
(self, path, count)
[]
def __convert_path(self, path, count): for i in range(count+1): if self.marked[path[i][0]][path[i][1]] == 1: self.marked[path[i][0]][path[i][1]] = 0 else: self.marked[path[i][0]][path[i][1]] = 1
[ "def", "__convert_path", "(", "self", ",", "path", ",", "count", ")", ":", "for", "i", "in", "range", "(", "count", "+", "1", ")", ":", "if", "self", ".", "marked", "[", "path", "[", "i", "]", "[", "0", "]", "]", "[", "path", "[", "i", "]", ...
https://github.com/rembo10/headphones/blob/b3199605be1ebc83a7a8feab6b1e99b64014187c/lib/munkres.py#L652-L657
ros/ros_comm
52b0556dadf3ec0c0bc72df4fc202153a53b539e
clients/rospy/src/rospy/impl/masterslave.py
python
ROSHandler.getSubscriptions
(self, caller_id)
return 1, "subscriptions", get_topic_manager().get_subscriptions()
Retrieve a list of topics that this node subscribes to. @param caller_id: ROS caller id @type caller_id: str @return: list of topics this node subscribes to. @rtype: [int, str, [ [topic1, topicType1]...[topicN, topicTypeN]]]
Retrieve a list of topics that this node subscribes to.
[ "Retrieve", "a", "list", "of", "topics", "that", "this", "node", "subscribes", "to", "." ]
def getSubscriptions(self, caller_id): """ Retrieve a list of topics that this node subscribes to. @param caller_id: ROS caller id @type caller_id: str @return: list of topics this node subscribes to. @rtype: [int, str, [ [topic1, topicType1]...[topicN, topicTypeN]]]...
[ "def", "getSubscriptions", "(", "self", ",", "caller_id", ")", ":", "return", "1", ",", "\"subscriptions\"", ",", "get_topic_manager", "(", ")", ".", "get_subscriptions", "(", ")" ]
https://github.com/ros/ros_comm/blob/52b0556dadf3ec0c0bc72df4fc202153a53b539e/clients/rospy/src/rospy/impl/masterslave.py#L384-L392
tornadoweb/tornado
208672f3bf6cbb7e37f54c356e02a71ca29f1e02
tornado/web.py
python
RequestHandler.get_cookie
(self, name: str, default: Optional[str] = None)
return default
Returns the value of the request cookie with the given name. If the named cookie is not present, returns ``default``. This method only returns cookies that were present in the request. It does not see the outgoing cookies set by `set_cookie` in this handler.
Returns the value of the request cookie with the given name.
[ "Returns", "the", "value", "of", "the", "request", "cookie", "with", "the", "given", "name", "." ]
def get_cookie(self, name: str, default: Optional[str] = None) -> Optional[str]: """Returns the value of the request cookie with the given name. If the named cookie is not present, returns ``default``. This method only returns cookies that were present in the request. It does not see t...
[ "def", "get_cookie", "(", "self", ",", "name", ":", "str", ",", "default", ":", "Optional", "[", "str", "]", "=", "None", ")", "->", "Optional", "[", "str", "]", ":", "if", "self", ".", "request", ".", "cookies", "is", "not", "None", "and", "name",...
https://github.com/tornadoweb/tornado/blob/208672f3bf6cbb7e37f54c356e02a71ca29f1e02/tornado/web.py#L579-L590
ray-project/ray
703c1610348615dcb8c2d141a0c46675084660f5
python/ray/autoscaler/_private/command_runner.py
python
_with_environment_variables
(cmd: str, environment_variables: Dict[str, object])
return all_vars + cmd
Prepend environment variables to a shell command. Args: cmd (str): The base command. environment_variables (Dict[str, object]): The set of environment variables. If an environment variable value is a dict, it will automatically be converted to a one line yaml string.
Prepend environment variables to a shell command.
[ "Prepend", "environment", "variables", "to", "a", "shell", "command", "." ]
def _with_environment_variables(cmd: str, environment_variables: Dict[str, object]): """Prepend environment variables to a shell command. Args: cmd (str): The base command. environment_variables (Dict[str, object]): The set of environment variables. I...
[ "def", "_with_environment_variables", "(", "cmd", ":", "str", ",", "environment_variables", ":", "Dict", "[", "str", ",", "object", "]", ")", ":", "as_strings", "=", "[", "]", "for", "key", ",", "val", "in", "environment_variables", ".", "items", "(", ")",...
https://github.com/ray-project/ray/blob/703c1610348615dcb8c2d141a0c46675084660f5/python/ray/autoscaler/_private/command_runner.py#L82-L99
ivre/ivre
5728855b51c0ae2e59450a1c3a782febcad2128b
ivre/active/data.py
python
cleanup_synack_honeypot_host
(host: NmapHost, update_openports: bool = True)
This function will clean the `host` record if it has too many (at least `VIEW_SYNACK_HONEYPOT_COUNT`) open ports that may be "syn-ack" honeypots (which means, ports for which is_real_service_port() returns False).
This function will clean the `host` record if it has too many (at least `VIEW_SYNACK_HONEYPOT_COUNT`) open ports that may be "syn-ack" honeypots (which means, ports for which is_real_service_port() returns False).
[ "This", "function", "will", "clean", "the", "host", "record", "if", "it", "has", "too", "many", "(", "at", "least", "VIEW_SYNACK_HONEYPOT_COUNT", ")", "open", "ports", "that", "may", "be", "syn", "-", "ack", "honeypots", "(", "which", "means", "ports", "fo...
def cleanup_synack_honeypot_host(host: NmapHost, update_openports: bool = True) -> None: """This function will clean the `host` record if it has too many (at least `VIEW_SYNACK_HONEYPOT_COUNT`) open ports that may be "syn-ack" honeypots (which means, ports for which is_real_service_port() returns False)...
[ "def", "cleanup_synack_honeypot_host", "(", "host", ":", "NmapHost", ",", "update_openports", ":", "bool", "=", "True", ")", "->", "None", ":", "if", "VIEW_SYNACK_HONEYPOT_COUNT", "is", "None", ":", "return", "n_ports", "=", "len", "(", "host", ".", "get", "...
https://github.com/ivre/ivre/blob/5728855b51c0ae2e59450a1c3a782febcad2128b/ivre/active/data.py#L243-L264
ynhacler/RedKindle
7c970920dc840f869e38cbda480d630cc2e7b200
rq2/job.py
python
get_current_job
()
return Job.fetch(job_id)
Returns the Job instance that is currently being executed. If this function is invoked from outside a job context, None is returned.
Returns the Job instance that is currently being executed. If this function is invoked from outside a job context, None is returned.
[ "Returns", "the", "Job", "instance", "that", "is", "currently", "being", "executed", ".", "If", "this", "function", "is", "invoked", "from", "outside", "a", "job", "context", "None", "is", "returned", "." ]
def get_current_job(): """Returns the Job instance that is currently being executed. If this function is invoked from outside a job context, None is returned. """ job_id = _job_stack.top if job_id is None: return None return Job.fetch(job_id)
[ "def", "get_current_job", "(", ")", ":", "job_id", "=", "_job_stack", ".", "top", "if", "job_id", "is", "None", ":", "return", "None", "return", "Job", ".", "fetch", "(", "job_id", ")" ]
https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/rq2/job.py#L59-L66
BlackLight/platypush
a6b552504e2ac327c94f3a28b607061b6b60cf36
platypush/plugins/music/mpd/__init__.py
python
MusicMpdPlugin.pause
(self)
Pause playback
Pause playback
[ "Pause", "playback" ]
def pause(self): """ Pause playback """ status = self.status().output['state'] if status == 'play': return self._exec('pause') else: return self._exec('play')
[ "def", "pause", "(", "self", ")", ":", "status", "=", "self", ".", "status", "(", ")", ".", "output", "[", "'state'", "]", "if", "status", "==", "'play'", ":", "return", "self", ".", "_exec", "(", "'pause'", ")", "else", ":", "return", "self", ".",...
https://github.com/BlackLight/platypush/blob/a6b552504e2ac327c94f3a28b607061b6b60cf36/platypush/plugins/music/mpd/__init__.py#L119-L126
Pylons/pyramid
0b24ac16cc04746b25cf460f1497c157f6d3d6f4
src/pyramid/interfaces.py
python
IResponse.app_iter_range
(start, stop)
Return a new app_iter built from the response app_iter that serves up only the given start:stop range.
Return a new app_iter built from the response app_iter that serves up only the given start:stop range.
[ "Return", "a", "new", "app_iter", "built", "from", "the", "response", "app_iter", "that", "serves", "up", "only", "the", "given", "start", ":", "stop", "range", "." ]
def app_iter_range(start, stop): """Return a new app_iter built from the response app_iter that serves up only the given start:stop range."""
[ "def", "app_iter_range", "(", "start", ",", "stop", ")", ":" ]
https://github.com/Pylons/pyramid/blob/0b24ac16cc04746b25cf460f1497c157f6d3d6f4/src/pyramid/interfaces.py#L112-L114
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/core/arrays/datetimes.py
python
maybe_convert_dtype
(data, copy: bool)
return data, copy
Convert data based on dtype conventions, issuing deprecation warnings or errors where appropriate. Parameters ---------- data : np.ndarray or pd.Index copy : bool Returns ------- data : np.ndarray or pd.Index copy : bool Raises ------ TypeError : PeriodDType data is pa...
Convert data based on dtype conventions, issuing deprecation warnings or errors where appropriate.
[ "Convert", "data", "based", "on", "dtype", "conventions", "issuing", "deprecation", "warnings", "or", "errors", "where", "appropriate", "." ]
def maybe_convert_dtype(data, copy: bool): """ Convert data based on dtype conventions, issuing deprecation warnings or errors where appropriate. Parameters ---------- data : np.ndarray or pd.Index copy : bool Returns ------- data : np.ndarray or pd.Index copy : bool R...
[ "def", "maybe_convert_dtype", "(", "data", ",", "copy", ":", "bool", ")", ":", "if", "not", "hasattr", "(", "data", ",", "\"dtype\"", ")", ":", "# e.g. collections.deque", "return", "data", ",", "copy", "if", "is_float_dtype", "(", "data", ".", "dtype", ")...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/core/arrays/datetimes.py#L2243-L2297
1012598167/flask_mongodb_game
60c7e0351586656ec38f851592886338e50b4110
python_flask/venv/Lib/site-packages/click/core.py
python
Context.lookup_default
(self, name)
Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available.
Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available.
[ "Looks", "up", "the", "default", "for", "a", "parameter", "name", ".", "This", "by", "default", "looks", "into", "the", ":", "attr", ":", "default_map", "if", "available", "." ]
def lookup_default(self, name): """Looks up the default for a parameter name. This by default looks into the :attr:`default_map` if available. """ if self.default_map is not None: rv = self.default_map.get(name) if callable(rv): rv = rv() ...
[ "def", "lookup_default", "(", "self", ",", "name", ")", ":", "if", "self", ".", "default_map", "is", "not", "None", ":", "rv", "=", "self", ".", "default_map", ".", "get", "(", "name", ")", "if", "callable", "(", "rv", ")", ":", "rv", "=", "rv", ...
https://github.com/1012598167/flask_mongodb_game/blob/60c7e0351586656ec38f851592886338e50b4110/python_flask/venv/Lib/site-packages/click/core.py#L480-L488
pandas-dev/pandas
5ba7d714014ae8feaccc0dd4a98890828cf2832d
pandas/io/pytables.py
python
HDFStore.info
(self)
return output
Print detailed information on the store. Returns ------- str
Print detailed information on the store.
[ "Print", "detailed", "information", "on", "the", "store", "." ]
def info(self) -> str: """ Print detailed information on the store. Returns ------- str """ path = pprint_thing(self._path) output = f"{type(self)}\nFile path: {path}\n" if self.is_open: lkeys = sorted(self.keys()) if len(...
[ "def", "info", "(", "self", ")", "->", "str", ":", "path", "=", "pprint_thing", "(", "self", ".", "_path", ")", "output", "=", "f\"{type(self)}\\nFile path: {path}\\n\"", "if", "self", ".", "is_open", ":", "lkeys", "=", "sorted", "(", "self", ".", "keys", ...
https://github.com/pandas-dev/pandas/blob/5ba7d714014ae8feaccc0dd4a98890828cf2832d/pandas/io/pytables.py#L1581-L1618
man-group/mdf
4b2c78084467791ad883c0b4c53832ad70fc96ef
mdf/context.py
python
NodeOrBuilderTimer.__exit__
(self, exc_type, exc_value, traceback)
[]
def __exit__(self, exc_type, exc_value, traceback): self.ctx._stop_timer()
[ "def", "__exit__", "(", "self", ",", "exc_type", ",", "exc_value", ",", "traceback", ")", ":", "self", ".", "ctx", ".", "_stop_timer", "(", ")" ]
https://github.com/man-group/mdf/blob/4b2c78084467791ad883c0b4c53832ad70fc96ef/mdf/context.py#L163-L164
rowliny/DiffHelper
ab3a96f58f9579d0023aed9ebd785f4edf26f8af
Tool/SitePackages/click/core.py
python
augment_usage_errors
( ctx: "Context", param: t.Optional["Parameter"] = None )
Context manager that attaches extra information to exceptions.
Context manager that attaches extra information to exceptions.
[ "Context", "manager", "that", "attaches", "extra", "information", "to", "exceptions", "." ]
def augment_usage_errors( ctx: "Context", param: t.Optional["Parameter"] = None ) -> t.Iterator[None]: """Context manager that attaches extra information to exceptions.""" try: yield except BadParameter as e: if e.ctx is None: e.ctx = ctx if param is not None and e.pa...
[ "def", "augment_usage_errors", "(", "ctx", ":", "\"Context\"", ",", "param", ":", "t", ".", "Optional", "[", "\"Parameter\"", "]", "=", "None", ")", "->", "t", ".", "Iterator", "[", "None", "]", ":", "try", ":", "yield", "except", "BadParameter", "as", ...
https://github.com/rowliny/DiffHelper/blob/ab3a96f58f9579d0023aed9ebd785f4edf26f8af/Tool/SitePackages/click/core.py#L97-L112
awslabs/deeplearning-benchmark
3e9a906422b402869537f91056ae771b66487a8e
tensorflow_benchmark/tf_cnn_benchmarks/variable_mgr.py
python
VariableMgrDistributedReplicated.get_gradients_to_apply
(self, device_num, gradient_state)
return avg_grads
[]
def get_gradients_to_apply(self, device_num, gradient_state): device_grads = gradient_state # From 2nd result of preprocess_device_grads. avg_grads = aggregate_gradients_using_copy_with_device_selection( self.benchmark_cnn, device_grads, use_mean=True) # Make shadow variable on a parameter server...
[ "def", "get_gradients_to_apply", "(", "self", ",", "device_num", ",", "gradient_state", ")", ":", "device_grads", "=", "gradient_state", "# From 2nd result of preprocess_device_grads.", "avg_grads", "=", "aggregate_gradients_using_copy_with_device_selection", "(", "self", ".", ...
https://github.com/awslabs/deeplearning-benchmark/blob/3e9a906422b402869537f91056ae771b66487a8e/tensorflow_benchmark/tf_cnn_benchmarks/variable_mgr.py#L881-L896
schutzwerk/CANalyzat0r
6bc251e69f73d9f8554bcc6134354e18ab8ca426
src/UDSTab.py
python
UDSTab.fuzzingModeChanged
(self)
This gets called if the ComboBox gets changed to update the active UDS fuzzing mode. The other GUI elements will be set and enabled depending on the selected mode.
This gets called if the ComboBox gets changed to update the active UDS fuzzing mode. The other GUI elements will be set and enabled depending on the selected mode.
[ "This", "gets", "called", "if", "the", "ComboBox", "gets", "changed", "to", "update", "the", "active", "UDS", "fuzzing", "mode", ".", "The", "other", "GUI", "elements", "will", "be", "set", "and", "enabled", "depending", "on", "the", "selected", "mode", "....
def fuzzingModeChanged(self): """ This gets called if the ComboBox gets changed to update the active UDS fuzzing mode. The other GUI elements will be set and enabled depending on the selected mode. """ selectedData = self.comboBoxUDSMode.itemData( self.comboBoxUDSMod...
[ "def", "fuzzingModeChanged", "(", "self", ")", ":", "selectedData", "=", "self", ".", "comboBoxUDSMode", ".", "itemData", "(", "self", ".", "comboBoxUDSMode", ".", "currentIndex", "(", ")", ")", "QtCore", ".", "QCoreApplication", ".", "processEvents", "(", ")"...
https://github.com/schutzwerk/CANalyzat0r/blob/6bc251e69f73d9f8554bcc6134354e18ab8ca426/src/UDSTab.py#L300-L309
1040003585/WebScrapingWithPython
a770fa5b03894076c8c9539b1ffff34424ffc016
portia_examle/lib/python2.7/site-packages/setuptools/command/bdist_egg.py
python
bdist_egg.get_ext_outputs
(self)
return all_outputs, ext_outputs
Get a list of relative paths to C extensions in the output distro
Get a list of relative paths to C extensions in the output distro
[ "Get", "a", "list", "of", "relative", "paths", "to", "C", "extensions", "in", "the", "output", "distro" ]
def get_ext_outputs(self): """Get a list of relative paths to C extensions in the output distro""" all_outputs = [] ext_outputs = [] paths = {self.bdist_dir: ''} for base, dirs, files in os.walk(self.bdist_dir): for filename in files: if os.path.spli...
[ "def", "get_ext_outputs", "(", "self", ")", ":", "all_outputs", "=", "[", "]", "ext_outputs", "=", "[", "]", "paths", "=", "{", "self", ".", "bdist_dir", ":", "''", "}", "for", "base", ",", "dirs", ",", "files", "in", "os", ".", "walk", "(", "self"...
https://github.com/1040003585/WebScrapingWithPython/blob/a770fa5b03894076c8c9539b1ffff34424ffc016/portia_examle/lib/python2.7/site-packages/setuptools/command/bdist_egg.py#L298-L324
microsoft/ptvsd
99c8513921021d2cc7cd82e132b65c644c256768
src/ptvsd/_vendored/pydevd/pydev_ipython/matplotlibtools.py
python
flag_calls
(func)
return wrapper
Wrap a function to detect and flag when it gets called. This is a decorator which takes a function and wraps it in a function with a 'called' attribute. wrapper.called is initialized to False. The wrapper.called attribute is set to False right before each call to the wrapped function, so if the call f...
Wrap a function to detect and flag when it gets called.
[ "Wrap", "a", "function", "to", "detect", "and", "flag", "when", "it", "gets", "called", "." ]
def flag_calls(func): """Wrap a function to detect and flag when it gets called. This is a decorator which takes a function and wraps it in a function with a 'called' attribute. wrapper.called is initialized to False. The wrapper.called attribute is set to False right before each call to the wrapp...
[ "def", "flag_calls", "(", "func", ")", ":", "# don't wrap twice", "if", "hasattr", "(", "func", ",", "'called'", ")", ":", "return", "func", "def", "wrapper", "(", "*", "args", ",", "*", "*", "kw", ")", ":", "wrapper", ".", "called", "=", "False", "o...
https://github.com/microsoft/ptvsd/blob/99c8513921021d2cc7cd82e132b65c644c256768/src/ptvsd/_vendored/pydevd/pydev_ipython/matplotlibtools.py#L110-L135
sony/nnabla-examples
068be490aacf73740502a1c3b10f8b2d15a52d32
responsible_ai/adversarial_debiasing/utils.py
python
get_fairness
(y, privileged_group, preds)
return demographic_parity_difference, equal_opportunity_difference, average_abs_odds_difference
Compute multiple fairness metrics for the classifier: 1. Demographic parity 2. Equal opportunity 3. Equalized odds Args: y : True data (or target, ground truth) privileged_group : list of privileged group values preds : data predicted (calculated, output) by your model Retu...
Compute multiple fairness metrics for the classifier: 1. Demographic parity 2. Equal opportunity 3. Equalized odds
[ "Compute", "multiple", "fairness", "metrics", "for", "the", "classifier", ":", "1", ".", "Demographic", "parity", "2", ".", "Equal", "opportunity", "3", ".", "Equalized", "odds" ]
def get_fairness(y, privileged_group, preds): """ Compute multiple fairness metrics for the classifier: 1. Demographic parity 2. Equal opportunity 3. Equalized odds Args: y : True data (or target, ground truth) privileged_group : list of privileged group values preds : d...
[ "def", "get_fairness", "(", "y", ",", "privileged_group", ",", "preds", ")", ":", "y_unprivileged", ",", "preds_unprivileged", "=", "y", "[", "privileged_group", "==", "False", "]", ",", "preds", "[", "privileged_group", "==", "False", "]", "y_privileged", ","...
https://github.com/sony/nnabla-examples/blob/068be490aacf73740502a1c3b10f8b2d15a52d32/responsible_ai/adversarial_debiasing/utils.py#L91-L134
python-excel/xlrd
0c4e80b3d48dfe2250ac4e514c8231a742fee221
xlrd/biffh.py
python
unpack_unicode
(data, pos, lenlen=2)
return strg
Return unicode_strg
Return unicode_strg
[ "Return", "unicode_strg" ]
def unpack_unicode(data, pos, lenlen=2): "Return unicode_strg" nchars = unpack('<' + 'BH'[lenlen-1], data[pos:pos+lenlen])[0] if not nchars: # Ambiguous whether 0-length string should have an "options" byte. # Avoid crash if missing. return UNICODE_LITERAL("") pos += lenlen o...
[ "def", "unpack_unicode", "(", "data", ",", "pos", ",", "lenlen", "=", "2", ")", ":", "nchars", "=", "unpack", "(", "'<'", "+", "'BH'", "[", "lenlen", "-", "1", "]", ",", "data", "[", "pos", ":", "pos", "+", "lenlen", "]", ")", "[", "0", "]", ...
https://github.com/python-excel/xlrd/blob/0c4e80b3d48dfe2250ac4e514c8231a742fee221/xlrd/biffh.py#L262-L299
nasa-gibs/onearth
accb40171af208934971ae027854cc2535e64968
src/mrfgen/mrfgen.py
python
mrf_block_align
(extents, xmin, ymin, xmax, ymax, target_x, target_y, mrf_blocksize)
return (str(ulx), str(uly), str(lrx), str(lry))
Aligns granule image to fit in a MRF block Arguments: extents -- spatial extents as ulx, uly, lrx, lry xmin -- Minimum x value ymin -- Minimum y value xmax -- Maximum x value ymax -- Maximum y value target_x -- The target resolution for x target_y -- The targe...
Aligns granule image to fit in a MRF block Arguments: extents -- spatial extents as ulx, uly, lrx, lry xmin -- Minimum x value ymin -- Minimum y value xmax -- Maximum x value ymax -- Maximum y value target_x -- The target resolution for x target_y -- The targe...
[ "Aligns", "granule", "image", "to", "fit", "in", "a", "MRF", "block", "Arguments", ":", "extents", "--", "spatial", "extents", "as", "ulx", "uly", "lrx", "lry", "xmin", "--", "Minimum", "x", "value", "ymin", "--", "Minimum", "y", "value", "xmax", "--", ...
def mrf_block_align(extents, xmin, ymin, xmax, ymax, target_x, target_y, mrf_blocksize): """ Aligns granule image to fit in a MRF block Arguments: extents -- spatial extents as ulx, uly, lrx, lry xmin -- Minimum x value ymin -- Minimum y value xmax -- Maximum x value ...
[ "def", "mrf_block_align", "(", "extents", ",", "xmin", ",", "ymin", ",", "xmax", ",", "ymax", ",", "target_x", ",", "target_y", ",", "mrf_blocksize", ")", ":", "extents", "=", "[", "Decimal", "(", "x", ")", "for", "x", "in", "extents", "]", "ulx", ",...
https://github.com/nasa-gibs/onearth/blob/accb40171af208934971ae027854cc2535e64968/src/mrfgen/mrfgen.py#L318-L368
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_ingress_service_backend.py
python
V1IngressServiceBackend.name
(self, name)
Sets the name of this V1IngressServiceBackend. Name is the referenced service. The service must exist in the same namespace as the Ingress object. # noqa: E501 :param name: The name of this V1IngressServiceBackend. # noqa: E501 :type: str
Sets the name of this V1IngressServiceBackend.
[ "Sets", "the", "name", "of", "this", "V1IngressServiceBackend", "." ]
def name(self, name): """Sets the name of this V1IngressServiceBackend. Name is the referenced service. The service must exist in the same namespace as the Ingress object. # noqa: E501 :param name: The name of this V1IngressServiceBackend. # noqa: E501 :type: str """ ...
[ "def", "name", "(", "self", ",", "name", ")", ":", "if", "self", ".", "local_vars_configuration", ".", "client_side_validation", "and", "name", "is", "None", ":", "# noqa: E501", "raise", "ValueError", "(", "\"Invalid value for `name`, must not be `None`\"", ")", "#...
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_ingress_service_backend.py#L71-L82
hardbyte/python-can
e7a2b040ee1f0cdd7fd77fbfef0454353166b333
can/interfaces/vector/canlib.py
python
VectorBus.__init__
( self, channel: Union[int, Sequence[int], str], can_filters: Optional[CanFilters] = None, poll_interval: float = 0.01, receive_own_messages: bool = False, bitrate: int = None, rx_queue_size: int = 2 ** 14, app_name: str = "CANalyzer", serial: int ...
:param channel: The channel indexes to create this bus with. Can also be a single integer or a comma separated string. :param can_filters: See :class:`can.BusABC`. :param receive_own_messages: See :class:`can.BusABC`. :param poll_interval: ...
:param channel: The channel indexes to create this bus with. Can also be a single integer or a comma separated string. :param can_filters: See :class:`can.BusABC`. :param receive_own_messages: See :class:`can.BusABC`. :param poll_interval: ...
[ ":", "param", "channel", ":", "The", "channel", "indexes", "to", "create", "this", "bus", "with", ".", "Can", "also", "be", "a", "single", "integer", "or", "a", "comma", "separated", "string", ".", ":", "param", "can_filters", ":", "See", ":", "class", ...
def __init__( self, channel: Union[int, Sequence[int], str], can_filters: Optional[CanFilters] = None, poll_interval: float = 0.01, receive_own_messages: bool = False, bitrate: int = None, rx_queue_size: int = 2 ** 14, app_name: str = "CANalyzer", ...
[ "def", "__init__", "(", "self", ",", "channel", ":", "Union", "[", "int", ",", "Sequence", "[", "int", "]", ",", "str", "]", ",", "can_filters", ":", "Optional", "[", "CanFilters", "]", "=", "None", ",", "poll_interval", ":", "float", "=", "0.01", ",...
https://github.com/hardbyte/python-can/blob/e7a2b040ee1f0cdd7fd77fbfef0454353166b333/can/interfaces/vector/canlib.py#L71-L340
tendenci/tendenci
0f2c348cc0e7d41bc56f50b00ce05544b083bf1d
tendenci/apps/memberships/forms.py
python
MembershipTypeForm.__init__
(self, *args, **kwargs)
[]
def __init__(self, *args, **kwargs): super(MembershipTypeForm, self).__init__(*args, **kwargs) self.type_exp_method_fields = type_exp_method_fields initial_list = [] if self.instance.pk: for field in self.type_exp_method_fields: field_value = getattr(self.in...
[ "def", "__init__", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "super", "(", "MembershipTypeForm", ",", "self", ")", ".", "__init__", "(", "*", "args", ",", "*", "*", "kwargs", ")", "self", ".", "type_exp_method_fields", "=", "t...
https://github.com/tendenci/tendenci/blob/0f2c348cc0e7d41bc56f50b00ce05544b083bf1d/tendenci/apps/memberships/forms.py#L229-L255
openstack/swift
b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100
swift/obj/diskfile.py
python
_decode_metadata
(metadata)
return dict(((to_str(k), to_str(v)) for k, v in metadata.items()))
Given a metadata dict from disk, convert keys and values to native strings. :param metadata: a dict
Given a metadata dict from disk, convert keys and values to native strings.
[ "Given", "a", "metadata", "dict", "from", "disk", "convert", "keys", "and", "values", "to", "native", "strings", "." ]
def _decode_metadata(metadata): """ Given a metadata dict from disk, convert keys and values to native strings. :param metadata: a dict """ if six.PY2: def to_str(item): if isinstance(item, six.text_type): return item.encode('utf8') return item el...
[ "def", "_decode_metadata", "(", "metadata", ")", ":", "if", "six", ".", "PY2", ":", "def", "to_str", "(", "item", ")", ":", "if", "isinstance", "(", "item", ",", "six", ".", "text_type", ")", ":", "return", "item", ".", "encode", "(", "'utf8'", ")", ...
https://github.com/openstack/swift/blob/b8d7c3dcb817504dcc0959ba52cc4ed2cf66c100/swift/obj/diskfile.py#L170-L187
ClusterHQ/flocker
eaa586248986d7cd681c99c948546c2b507e44de
flocker/node/_loop.py
python
_UnconvergedDelay.sleep
(self)
return s
Get the duration that should be slept for this iteration. :return _Sleep: an instance of `_Sleep` with a duration following an exponential backoff curve.
Get the duration that should be slept for this iteration.
[ "Get", "the", "duration", "that", "should", "be", "slept", "for", "this", "iteration", "." ]
def sleep(self): """ Get the duration that should be slept for this iteration. :return _Sleep: an instance of `_Sleep` with a duration following an exponential backoff curve. """ Message.log( message_type=u'flocker:node:_loop:delay', log_level...
[ "def", "sleep", "(", "self", ")", ":", "Message", ".", "log", "(", "message_type", "=", "u'flocker:node:_loop:delay'", ",", "log_level", "=", "u'INFO'", ",", "message", "=", "u'Intentionally delaying the next iteration of the '", "u'convergence loop to avoid RequestLimitExc...
https://github.com/ClusterHQ/flocker/blob/eaa586248986d7cd681c99c948546c2b507e44de/flocker/node/_loop.py#L313-L331
OCA/reporting-engine
93a005f241a99ef9921d12e9a34a6cf2ea5a3be4
report_py3o_fusion_server/models/py3o_report.py
python
Py3oReport._create_single_report
(self, model_instance, data)
return result_path
This function to generate our py3o report
This function to generate our py3o report
[ "This", "function", "to", "generate", "our", "py3o", "report" ]
def _create_single_report(self, model_instance, data): """This function to generate our py3o report""" self.ensure_one() report_xml = self.ir_actions_report_id filetype = report_xml.py3o_filetype if not report_xml.py3o_server_id: return super()._create_single_report(m...
[ "def", "_create_single_report", "(", "self", ",", "model_instance", ",", "data", ")", ":", "self", ".", "ensure_one", "(", ")", "report_xml", "=", "self", ".", "ir_actions_report_id", "filetype", "=", "report_xml", ".", "py3o_filetype", "if", "not", "report_xml"...
https://github.com/OCA/reporting-engine/blob/93a005f241a99ef9921d12e9a34a6cf2ea5a3be4/report_py3o_fusion_server/models/py3o_report.py#L30-L106
aleju/imgaug
0101108d4fed06bc5056c4a03e2bcb0216dac326
imgaug/augmenters/overlay.py
python
FrequencyNoiseAlpha
(*args, **kwargs)
return blend.FrequencyNoiseAlpha(*args, **kwargs)
See :class:`~imgaug.augmenters.blend.BlendAlphaFrequencyNoise`.
See :class:`~imgaug.augmenters.blend.BlendAlphaFrequencyNoise`.
[ "See", ":", "class", ":", "~imgaug", ".", "augmenters", ".", "blend", ".", "BlendAlphaFrequencyNoise", "." ]
def FrequencyNoiseAlpha(*args, **kwargs): """See :class:`~imgaug.augmenters.blend.BlendAlphaFrequencyNoise`.""" # pylint: disable=invalid-name return blend.FrequencyNoiseAlpha(*args, **kwargs)
[ "def", "FrequencyNoiseAlpha", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# pylint: disable=invalid-name", "return", "blend", ".", "FrequencyNoiseAlpha", "(", "*", "args", ",", "*", "*", "kwargs", ")" ]
https://github.com/aleju/imgaug/blob/0101108d4fed06bc5056c4a03e2bcb0216dac326/imgaug/augmenters/overlay.py#L53-L56
MechanicalSoup/MechanicalSoup
72783b827b176bec8a3f9672a5222ce835b72a82
mechanicalsoup/form.py
python
Form.set_checkbox
(self, data, uncheck_other_boxes=True)
Set the *checked*-attribute of input elements of type "checkbox" specified by ``data`` (i.e. check boxes). :param data: Dict of ``{name: value, ...}``. In the family of checkboxes whose *name*-attribute is ``name``, check the box whose *value*-attribute is ``value``. All boxes i...
Set the *checked*-attribute of input elements of type "checkbox" specified by ``data`` (i.e. check boxes).
[ "Set", "the", "*", "checked", "*", "-", "attribute", "of", "input", "elements", "of", "type", "checkbox", "specified", "by", "data", "(", "i", ".", "e", ".", "check", "boxes", ")", "." ]
def set_checkbox(self, data, uncheck_other_boxes=True): """Set the *checked*-attribute of input elements of type "checkbox" specified by ``data`` (i.e. check boxes). :param data: Dict of ``{name: value, ...}``. In the family of checkboxes whose *name*-attribute is ``name``, ...
[ "def", "set_checkbox", "(", "self", ",", "data", ",", "uncheck_other_boxes", "=", "True", ")", ":", "for", "(", "name", ",", "value", ")", "in", "data", ".", "items", "(", ")", ":", "# Case-insensitive search for type=checkbox", "selector", "=", "'input[type=\...
https://github.com/MechanicalSoup/MechanicalSoup/blob/72783b827b176bec8a3f9672a5222ce835b72a82/mechanicalsoup/form.py#L100-L148
MultiChain/multichain-explorer
9e850fa79d0759b7348647ccf73a31d387c945a5
Mce/SqlAbstraction.py
python
SqlAbstraction.cursor
(sql)
return sql._cursor
[]
def cursor(sql): if sql._cursor is None: sql._cursor = sql.conn().cursor() return sql._cursor
[ "def", "cursor", "(", "sql", ")", ":", "if", "sql", ".", "_cursor", "is", "None", ":", "sql", ".", "_cursor", "=", "sql", ".", "conn", "(", ")", ".", "cursor", "(", ")", "return", "sql", ".", "_cursor" ]
https://github.com/MultiChain/multichain-explorer/blob/9e850fa79d0759b7348647ccf73a31d387c945a5/Mce/SqlAbstraction.py#L256-L259
golismero/golismero
7d605b937e241f51c1ca4f47b20f755eeefb9d76
thirdparty_libs/nltk/featstruct.py
python
subsumes
(fstruct1, fstruct2)
return fstruct2 == unify(fstruct1, fstruct2)
Return True if ``fstruct1`` subsumes ``fstruct2``. I.e., return true if unifying ``fstruct1`` with ``fstruct2`` would result in a feature structure equal to ``fstruct2.`` :rtype: bool
Return True if ``fstruct1`` subsumes ``fstruct2``. I.e., return true if unifying ``fstruct1`` with ``fstruct2`` would result in a feature structure equal to ``fstruct2.``
[ "Return", "True", "if", "fstruct1", "subsumes", "fstruct2", ".", "I", ".", "e", ".", "return", "true", "if", "unifying", "fstruct1", "with", "fstruct2", "would", "result", "in", "a", "feature", "structure", "equal", "to", "fstruct2", "." ]
def subsumes(fstruct1, fstruct2): """ Return True if ``fstruct1`` subsumes ``fstruct2``. I.e., return true if unifying ``fstruct1`` with ``fstruct2`` would result in a feature structure equal to ``fstruct2.`` :rtype: bool """ return fstruct2 == unify(fstruct1, fstruct2)
[ "def", "subsumes", "(", "fstruct1", ",", "fstruct2", ")", ":", "return", "fstruct2", "==", "unify", "(", "fstruct1", ",", "fstruct2", ")" ]
https://github.com/golismero/golismero/blob/7d605b937e241f51c1ca4f47b20f755eeefb9d76/thirdparty_libs/nltk/featstruct.py#L1621-L1629
openwpm/OpenWPM
771b6db4169374a7f7b6eb5ce6e59ea763f26df4
openwpm/command_sequence.py
python
CommandSequence.screenshot_full_page
(self, suffix="", timeout=30)
Save a screenshot of the entire page. NOTE: geckodriver v0.15 only supports viewport screenshots. To screenshot the entire page we scroll the page using javascript and take a viewport screenshot at each location. This method will save the parts and a stitched version in the `screenshot_...
Save a screenshot of the entire page.
[ "Save", "a", "screenshot", "of", "the", "entire", "page", "." ]
def screenshot_full_page(self, suffix="", timeout=30): """Save a screenshot of the entire page. NOTE: geckodriver v0.15 only supports viewport screenshots. To screenshot the entire page we scroll the page using javascript and take a viewport screenshot at each location. This method will...
[ "def", "screenshot_full_page", "(", "self", ",", "suffix", "=", "\"\"", ",", "timeout", "=", "30", ")", ":", "self", ".", "total_timeout", "+=", "timeout", "if", "not", "self", ".", "contains_get_or_browse", ":", "raise", "CommandExecutionError", "(", "\"No ge...
https://github.com/openwpm/OpenWPM/blob/771b6db4169374a7f7b6eb5ce6e59ea763f26df4/openwpm/command_sequence.py#L114-L140
sergioburdisso/pyss3
70c37853f3f56a60c3df9b94b678ca3f0db843de
pyss3/__init__.py
python
SS3.__sg_xai__
(self, ngram, icat, cache=True)
A variation of the significance (sn) function. This version of the sg function adds extra checks to improve visual explanations.
A variation of the significance (sn) function.
[ "A", "variation", "of", "the", "significance", "(", "sn", ")", "function", "." ]
def __sg_xai__(self, ngram, icat, cache=True): """ A variation of the significance (sn) function. This version of the sg function adds extra checks to improve visual explanations. """ try: if cache: return self.__trie_node__(ngram, icat)[SG] ...
[ "def", "__sg_xai__", "(", "self", ",", "ngram", ",", "icat", ",", "cache", "=", "True", ")", ":", "try", ":", "if", "cache", ":", "return", "self", ".", "__trie_node__", "(", "ngram", ",", "icat", ")", "[", "SG", "]", "else", ":", "ncats", "=", "...
https://github.com/sergioburdisso/pyss3/blob/70c37853f3f56a60c3df9b94b678ca3f0db843de/pyss3/__init__.py#L247-L281
onaio/onadata
89ad16744e8f247fb748219476f6ac295869a95f
onadata/apps/sms_support/providers/textit.py
python
process_message_for_textit
(username, sms_identity, sms_text, sms_time, id_string, payload={})
return get_response(response)
Process a text instance and return in SMSSync expected format
Process a text instance and return in SMSSync expected format
[ "Process", "a", "text", "instance", "and", "return", "in", "SMSSync", "expected", "format" ]
def process_message_for_textit(username, sms_identity, sms_text, sms_time, id_string, payload={}): """ Process a text instance and return in SMSSync expected format """ if not sms_identity or not sms_text: return get_response({'code': SMS_API_ERROR, ...
[ "def", "process_message_for_textit", "(", "username", ",", "sms_identity", ",", "sms_text", ",", "sms_time", ",", "id_string", ",", "payload", "=", "{", "}", ")", ":", "if", "not", "sms_identity", "or", "not", "sms_text", ":", "return", "get_response", "(", ...
https://github.com/onaio/onadata/blob/89ad16744e8f247fb748219476f6ac295869a95f/onadata/apps/sms_support/providers/textit.py#L120-L134
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/contrib/gis/geos/polygon.py
python
Polygon.from_bbox
(cls, bbox)
return Polygon(((x0, y0), (x0, y1), (x1, y1), (x1, y0), (x0, y0)))
Constructs a Polygon from a bounding box (4-tuple).
Constructs a Polygon from a bounding box (4-tuple).
[ "Constructs", "a", "Polygon", "from", "a", "bounding", "box", "(", "4", "-", "tuple", ")", "." ]
def from_bbox(cls, bbox): "Constructs a Polygon from a bounding box (4-tuple)." x0, y0, x1, y1 = bbox for z in bbox: if not isinstance(z, six.integer_types + (float,)): return GEOSGeometry('POLYGON((%s %s, %s %s, %s %s, %s %s, %s %s))' % ...
[ "def", "from_bbox", "(", "cls", ",", "bbox", ")", ":", "x0", ",", "y0", ",", "x1", ",", "y1", "=", "bbox", "for", "z", "in", "bbox", ":", "if", "not", "isinstance", "(", "z", ",", "six", ".", "integer_types", "+", "(", "float", ",", ")", ")", ...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/contrib/gis/geos/polygon.py#L57-L64
oracle/graalpython
577e02da9755d916056184ec441c26e00b70145c
graalpython/lib-python/3/multiprocessing/process.py
python
BaseProcess.sentinel
(self)
Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.
Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination.
[ "Return", "a", "file", "descriptor", "(", "Unix", ")", "or", "handle", "(", "Windows", ")", "suitable", "for", "waiting", "for", "process", "termination", "." ]
def sentinel(self): ''' Return a file descriptor (Unix) or handle (Windows) suitable for waiting for process termination. ''' self._check_closed() try: return self._sentinel except AttributeError: raise ValueError("process not started") fro...
[ "def", "sentinel", "(", "self", ")", ":", "self", ".", "_check_closed", "(", ")", "try", ":", "return", "self", ".", "_sentinel", "except", "AttributeError", ":", "raise", "ValueError", "(", "\"process not started\"", ")", "from", "None" ]
https://github.com/oracle/graalpython/blob/577e02da9755d916056184ec441c26e00b70145c/graalpython/lib-python/3/multiprocessing/process.py#L268-L277
pymedusa/Medusa
1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38
ext/urllib3/response.py
python
HTTPResponse.read_chunked
(self, amt=None, decode_content=None)
Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to cache partial content as the full response. :param deco...
Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``.
[ "Similar", "to", ":", "meth", ":", "HTTPResponse", ".", "read", "but", "with", "an", "additional", "parameter", ":", "decode_content", "." ]
def read_chunked(self, amt=None, decode_content=None): """ Similar to :meth:`HTTPResponse.read`, but with an additional parameter: ``decode_content``. :param amt: How much of the content to read. If specified, caching is skipped because it doesn't make sense to c...
[ "def", "read_chunked", "(", "self", ",", "amt", "=", "None", ",", "decode_content", "=", "None", ")", ":", "self", ".", "_init_decoder", "(", ")", "# FIXME: Rewrite this method and make it a class with a better structured logic.", "if", "not", "self", ".", "chunked", ...
https://github.com/pymedusa/Medusa/blob/1405fbb6eb8ef4d20fcca24c32ddca52b11f0f38/ext/urllib3/response.py#L629-L694
ni/nidaqmx-python
62fc6b48cbbb330fe1bcc9aedadc86610a1269b6
nidaqmx/_task_modules/channels/ci_channel.py
python
CIChannel.ci_lin_encoder_dist_per_pulse
(self)
return val.value
float: Specifies the distance to measure for each pulse the encoder generates on signal A or signal B. This value is in the units you specify with **ci_lin_encoder_units**.
float: Specifies the distance to measure for each pulse the encoder generates on signal A or signal B. This value is in the units you specify with **ci_lin_encoder_units**.
[ "float", ":", "Specifies", "the", "distance", "to", "measure", "for", "each", "pulse", "the", "encoder", "generates", "on", "signal", "A", "or", "signal", "B", ".", "This", "value", "is", "in", "the", "units", "you", "specify", "with", "**", "ci_lin_encode...
def ci_lin_encoder_dist_per_pulse(self): """ float: Specifies the distance to measure for each pulse the encoder generates on signal A or signal B. This value is in the units you specify with **ci_lin_encoder_units**. """ val = ctypes.c_double() cfunc = l...
[ "def", "ci_lin_encoder_dist_per_pulse", "(", "self", ")", ":", "val", "=", "ctypes", ".", "c_double", "(", ")", "cfunc", "=", "lib_importer", ".", "windll", ".", "DAQmxGetCILinEncoderDistPerPulse", "if", "cfunc", ".", "argtypes", "is", "None", ":", "with", "cf...
https://github.com/ni/nidaqmx-python/blob/62fc6b48cbbb330fe1bcc9aedadc86610a1269b6/nidaqmx/_task_modules/channels/ci_channel.py#L5686-L5706
NifTK/NiftyNet
935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0
niftynet/utilities/download.py
python
ConfigStoreCache.get_local_cache_folder
(self)
return self._cache_folder
Returns the folder in which the cached files are stored
Returns the folder in which the cached files are stored
[ "Returns", "the", "folder", "in", "which", "the", "cached", "files", "are", "stored" ]
def get_local_cache_folder(self): """ Returns the folder in which the cached files are stored """ return self._cache_folder
[ "def", "get_local_cache_folder", "(", "self", ")", ":", "return", "self", ".", "_cache_folder" ]
https://github.com/NifTK/NiftyNet/blob/935bf4334cd00fa9f9d50f6a95ddcbfdde4031e0/niftynet/utilities/download.py#L344-L349
LabPy/lantz
3e878e3f765a4295b0089d04e241d4beb7b8a65b
lantz/drivers/andor/ccd.py
python
CCD.baseline_offset
(self)
return self.baseline_offset_value
This function allows the user to move the baseline level by the amount selected. For example “+100” will add approximately 100 counts to the default baseline value. The value entered should be a multiple of 100 between -1000 and +1000 inclusively.
This function allows the user to move the baseline level by the amount selected. For example “+100” will add approximately 100 counts to the default baseline value. The value entered should be a multiple of 100 between -1000 and +1000 inclusively.
[ "This", "function", "allows", "the", "user", "to", "move", "the", "baseline", "level", "by", "the", "amount", "selected", ".", "For", "example", "“", "+", "100”", "will", "add", "approximately", "100", "counts", "to", "the", "default", "baseline", "value", ...
def baseline_offset(self): """This function allows the user to move the baseline level by the amount selected. For example “+100” will add approximately 100 counts to the default baseline value. The value entered should be a multiple of 100 between -1000 and +1000 inclusively. ""...
[ "def", "baseline_offset", "(", "self", ")", ":", "return", "self", ".", "baseline_offset_value" ]
https://github.com/LabPy/lantz/blob/3e878e3f765a4295b0089d04e241d4beb7b8a65b/lantz/drivers/andor/ccd.py#L1649-L1655
python/cpython
e13cdca0f5224ec4e23bdd04bb3120506964bc8b
Lib/_collections_abc.py
python
clear
(self)
D.clear() -> None. Remove all items from D.
D.clear() -> None. Remove all items from D.
[ "D", ".", "clear", "()", "-", ">", "None", ".", "Remove", "all", "items", "from", "D", "." ]
def clear(self): 'D.clear() -> None. Remove all items from D.' try: while True: self.popitem() except KeyError: pass
[ "def", "clear", "(", "self", ")", ":", "try", ":", "while", "True", ":", "self", ".", "popitem", "(", ")", "except", "KeyError", ":", "pass" ]
https://github.com/python/cpython/blob/e13cdca0f5224ec4e23bdd04bb3120506964bc8b/Lib/_collections_abc.py#L975-L981
caiiiac/Machine-Learning-with-Python
1a26c4467da41ca4ebc3d5bd789ea942ef79422f
MachineLearning/venv/lib/python3.5/site-packages/wheel/signatures/keys.py
python
WheelKeys.add_signer
(self, scope, vk)
Remember verifying key vk as being valid for signing in scope.
Remember verifying key vk as being valid for signing in scope.
[ "Remember", "verifying", "key", "vk", "as", "being", "valid", "for", "signing", "in", "scope", "." ]
def add_signer(self, scope, vk): """Remember verifying key vk as being valid for signing in scope.""" self.data['signers'].append({'scope':scope, 'vk':vk})
[ "def", "add_signer", "(", "self", ",", "scope", ",", "vk", ")", ":", "self", ".", "data", "[", "'signers'", "]", ".", "append", "(", "{", "'scope'", ":", "scope", ",", "'vk'", ":", "vk", "}", ")" ]
https://github.com/caiiiac/Machine-Learning-with-Python/blob/1a26c4467da41ca4ebc3d5bd789ea942ef79422f/MachineLearning/venv/lib/python3.5/site-packages/wheel/signatures/keys.py#L96-L98
onnx/onnx-coreml
141fc33d7217674ea8bda36494fa8089a543a3f3
onnx_coreml/converter.py
python
_check_unsupported_ops
(nodes, disable_coreml_rank5_mapping=False)
[]
def _check_unsupported_ops(nodes, disable_coreml_rank5_mapping=False): # type: (...) -> None unsupported_op_types = [] # type: List[Text] for node in nodes: if disable_coreml_rank5_mapping: if node.op_type not in _ONNX_NODE_REGISTRY_ND and \ node.op_type not in unsupport...
[ "def", "_check_unsupported_ops", "(", "nodes", ",", "disable_coreml_rank5_mapping", "=", "False", ")", ":", "# type: (...) -> None", "unsupported_op_types", "=", "[", "]", "# type: List[Text]", "for", "node", "in", "nodes", ":", "if", "disable_coreml_rank5_mapping", ":"...
https://github.com/onnx/onnx-coreml/blob/141fc33d7217674ea8bda36494fa8089a543a3f3/onnx_coreml/converter.py#L206-L227
tensorflow/tensorboard
61d11d99ef034c30ba20b6a7840c8eededb9031c
tensorboard/plugins/debugger_v2/debugger_v2_plugin.py
python
_missing_run_error_response
(request)
return _error_response(request, "run parameter is not provided")
[]
def _missing_run_error_response(request): return _error_response(request, "run parameter is not provided")
[ "def", "_missing_run_error_response", "(", "request", ")", ":", "return", "_error_response", "(", "request", ",", "\"run parameter is not provided\"", ")" ]
https://github.com/tensorflow/tensorboard/blob/61d11d99ef034c30ba20b6a7840c8eededb9031c/tensorboard/plugins/debugger_v2/debugger_v2_plugin.py#L38-L39
medipixel/rl_algorithms
c5f7d1d60dcefb3050d75c5c657207183bd8db65
rl_algorithms/common/networks/heads.py
python
init_layer_uniform
(layer: nn.Linear, init_w: float = 3e-3)
return layer
Init uniform parameters on the single layer
Init uniform parameters on the single layer
[ "Init", "uniform", "parameters", "on", "the", "single", "layer" ]
def init_layer_uniform(layer: nn.Linear, init_w: float = 3e-3) -> nn.Linear: """Init uniform parameters on the single layer""" layer.weight.data.uniform_(-init_w, init_w) layer.bias.data.uniform_(-init_w, init_w) return layer
[ "def", "init_layer_uniform", "(", "layer", ":", "nn", ".", "Linear", ",", "init_w", ":", "float", "=", "3e-3", ")", "->", "nn", ".", "Linear", ":", "layer", ".", "weight", ".", "data", ".", "uniform_", "(", "-", "init_w", ",", "init_w", ")", "layer",...
https://github.com/medipixel/rl_algorithms/blob/c5f7d1d60dcefb3050d75c5c657207183bd8db65/rl_algorithms/common/networks/heads.py#L23-L28
autotest/autotest
4614ae5f550cc888267b9a419e4b90deb54f8fae
client/shared/hosts/base_classes.py
python
Host.cleanup_kernels
(self, boot_dir='/boot')
Remove any kernel image and associated files (vmlinux, system.map, modules) for any image found in the boot directory that is not referenced by entries in the bootloader configuration. :param boot_dir: boot directory path string, default '/boot'
Remove any kernel image and associated files (vmlinux, system.map, modules) for any image found in the boot directory that is not referenced by entries in the bootloader configuration.
[ "Remove", "any", "kernel", "image", "and", "associated", "files", "(", "vmlinux", "system", ".", "map", "modules", ")", "for", "any", "image", "found", "in", "the", "boot", "directory", "that", "is", "not", "referenced", "by", "entries", "in", "the", "boot...
def cleanup_kernels(self, boot_dir='/boot'): """ Remove any kernel image and associated files (vmlinux, system.map, modules) for any image found in the boot directory that is not referenced by entries in the bootloader configuration. :param boot_dir: boot directory path string, ...
[ "def", "cleanup_kernels", "(", "self", ",", "boot_dir", "=", "'/boot'", ")", ":", "# find all the vmlinuz images referenced by the bootloader", "boot_info", "=", "self", ".", "bootloader", ".", "get_entries", "(", ")", "used_kernver", "=", "[", "]", "for", "boot", ...
https://github.com/autotest/autotest/blob/4614ae5f550cc888267b9a419e4b90deb54f8fae/client/shared/hosts/base_classes.py#L595-L665
ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework
cb692f527e4e819b6c228187c5702d990a180043
bin/x86/Debug/scripting_engine/Lib/Bastion.py
python
BastionClass.__init__
(self, get, name)
Constructor. Arguments: get - a function that gets the attribute value (by name) name - a human-readable name for the original object (suggestion: use repr(object))
Constructor.
[ "Constructor", "." ]
def __init__(self, get, name): """Constructor. Arguments: get - a function that gets the attribute value (by name) name - a human-readable name for the original object (suggestion: use repr(object)) """ self._get_ = get self._name_ = name
[ "def", "__init__", "(", "self", ",", "get", ",", "name", ")", ":", "self", ".", "_get_", "=", "get", "self", ".", "_name_", "=", "name" ]
https://github.com/ajinabraham/OWASP-Xenotix-XSS-Exploit-Framework/blob/cb692f527e4e819b6c228187c5702d990a180043/bin/x86/Debug/scripting_engine/Lib/Bastion.py#L47-L58
hupili/snsapi
129529b89f38cbee253a23e5ed31dae2a0ea4254
snsapi/third/feedparser.py
python
_BaseHTMLProcessor.output
(self)
return ''.join([str(p) for p in self.pieces])
Return processed HTML as a single string
Return processed HTML as a single string
[ "Return", "processed", "HTML", "as", "a", "single", "string" ]
def output(self): '''Return processed HTML as a single string''' return ''.join([str(p) for p in self.pieces])
[ "def", "output", "(", "self", ")", ":", "return", "''", ".", "join", "(", "[", "str", "(", "p", ")", "for", "p", "in", "self", ".", "pieces", "]", ")" ]
https://github.com/hupili/snsapi/blob/129529b89f38cbee253a23e5ed31dae2a0ea4254/snsapi/third/feedparser.py#L2048-L2050
microsoft/msticpy
2a401444ee529114004f496f4c0376ff25b5268a
msticpy/nbtools/nbwidgets.py
python
OptionButtons._create_button_callbacks
(self, btns)
Set up buttons.
Set up buttons.
[ "Set", "up", "buttons", "." ]
def _create_button_callbacks(self, btns): """Set up buttons.""" def getvalue(change): """Button on_click handler.""" self.value = change.description for btn in btns: btn.on_click(getvalue, remove=True) for btn in btns: btn.on_clic...
[ "def", "_create_button_callbacks", "(", "self", ",", "btns", ")", ":", "def", "getvalue", "(", "change", ")", ":", "\"\"\"Button on_click handler.\"\"\"", "self", ".", "value", "=", "change", ".", "description", "for", "btn", "in", "btns", ":", "btn", ".", "...
https://github.com/microsoft/msticpy/blob/2a401444ee529114004f496f4c0376ff25b5268a/msticpy/nbtools/nbwidgets.py#L1664-L1674
iopsgroup/imoocc
de810eb6d4c1697b7139305925a5b0ba21225f3f
extra_apps/xadmin/views/list.py
python
ListAdminView.get_list_display
(self)
return list(self.base_list_display)
Return a sequence containing the fields to be displayed on the list.
Return a sequence containing the fields to be displayed on the list.
[ "Return", "a", "sequence", "containing", "the", "fields", "to", "be", "displayed", "on", "the", "list", "." ]
def get_list_display(self): """ Return a sequence containing the fields to be displayed on the list. """ self.base_list_display = (COL_LIST_VAR in self.request.GET and self.request.GET[COL_LIST_VAR] != "" and \ self.request.GET[COL_LIST_VAR].split('.')) or self.list_display ...
[ "def", "get_list_display", "(", "self", ")", ":", "self", ".", "base_list_display", "=", "(", "COL_LIST_VAR", "in", "self", ".", "request", ".", "GET", "and", "self", ".", "request", ".", "GET", "[", "COL_LIST_VAR", "]", "!=", "\"\"", "and", "self", ".",...
https://github.com/iopsgroup/imoocc/blob/de810eb6d4c1697b7139305925a5b0ba21225f3f/extra_apps/xadmin/views/list.py#L148-L154
stepjam/PyRep
d778d5d4ffa3be366d4e699f6e2941553fd47ecc
pyrep/objects/object.py
python
Object.get_quaternion
(self, relative_to=None)
return np.array(quaternion, dtype=np.float64)
Retrieves the quaternion (x,y,z,w) of an object. :param relative_to: Indicates relative to which reference frame we want the orientation. Specify None to retrieve the absolute orientation, or an Object relative to whose reference frame we want the orientation. :retur...
Retrieves the quaternion (x,y,z,w) of an object.
[ "Retrieves", "the", "quaternion", "(", "x", "y", "z", "w", ")", "of", "an", "object", "." ]
def get_quaternion(self, relative_to=None) -> np.ndarray: """Retrieves the quaternion (x,y,z,w) of an object. :param relative_to: Indicates relative to which reference frame we want the orientation. Specify None to retrieve the absolute orientation, or an Object relative to whos...
[ "def", "get_quaternion", "(", "self", ",", "relative_to", "=", "None", ")", "->", "np", ".", "ndarray", ":", "relto", "=", "-", "1", "if", "relative_to", "is", "None", "else", "relative_to", ".", "get_handle", "(", ")", "quaternion", "=", "sim", ".", "...
https://github.com/stepjam/PyRep/blob/d778d5d4ffa3be366d4e699f6e2941553fd47ecc/pyrep/objects/object.py#L187-L198
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/tencentcloud/dcdb/v20180411/dcdb_client.py
python
DcdbClient.DescribeDBLogFiles
(self, request)
本接口(DescribeDBLogFiles)用于获取数据库的各种日志列表,包括冷备、binlog、errlog和slowlog。 :param request: 调用DescribeDBLogFiles所需参数的结构体。 :type request: :class:`tencentcloud.dcdb.v20180411.models.DescribeDBLogFilesRequest` :rtype: :class:`tencentcloud.dcdb.v20180411.models.DescribeDBLogFilesResponse`
本接口(DescribeDBLogFiles)用于获取数据库的各种日志列表,包括冷备、binlog、errlog和slowlog。
[ "本接口", "(", "DescribeDBLogFiles", ")", "用于获取数据库的各种日志列表,包括冷备、binlog、errlog和slowlog。" ]
def DescribeDBLogFiles(self, request): """本接口(DescribeDBLogFiles)用于获取数据库的各种日志列表,包括冷备、binlog、errlog和slowlog。 :param request: 调用DescribeDBLogFiles所需参数的结构体。 :type request: :class:`tencentcloud.dcdb.v20180411.models.DescribeDBLogFilesRequest` :rtype: :class:`tencentcloud.dcdb.v20180411.mode...
[ "def", "DescribeDBLogFiles", "(", "self", ",", "request", ")", ":", "try", ":", "params", "=", "request", ".", "_serialize", "(", ")", "body", "=", "self", ".", "call", "(", "\"DescribeDBLogFiles\"", ",", "params", ")", "response", "=", "json", ".", "loa...
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/tencentcloud/dcdb/v20180411/dcdb_client.py#L56-L81
openedx/edx-platform
68dd185a0ab45862a2a61e0f803d7e03d2be71b5
openedx/core/djangoapps/common_views/xblock.py
python
xblock_resource
(request, block_type, uri)
return HttpResponse(content, content_type=mimetype)
Return a package resource for the specified XBlock.
Return a package resource for the specified XBlock.
[ "Return", "a", "package", "resource", "for", "the", "specified", "XBlock", "." ]
def xblock_resource(request, block_type, uri): # pylint: disable=unused-argument """ Return a package resource for the specified XBlock. """ try: # Figure out what the XBlock class is from the block type, and # then open whatever resource has been requested. xblock_class = XBloc...
[ "def", "xblock_resource", "(", "request", ",", "block_type", ",", "uri", ")", ":", "# pylint: disable=unused-argument", "try", ":", "# Figure out what the XBlock class is from the block type, and", "# then open whatever resource has been requested.", "xblock_class", "=", "XBlock", ...
https://github.com/openedx/edx-platform/blob/68dd185a0ab45862a2a61e0f803d7e03d2be71b5/openedx/core/djangoapps/common_views/xblock.py#L16-L33
edisonlz/fastor
342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3
base/site-packages/django/template/defaulttags.py
python
comment
(parser, token)
return CommentNode()
Ignores everything between ``{% comment %}`` and ``{% endcomment %}``.
Ignores everything between ``{% comment %}`` and ``{% endcomment %}``.
[ "Ignores", "everything", "between", "{", "%", "comment", "%", "}", "and", "{", "%", "endcomment", "%", "}", "." ]
def comment(parser, token): """ Ignores everything between ``{% comment %}`` and ``{% endcomment %}``. """ parser.skip_past('endcomment') return CommentNode()
[ "def", "comment", "(", "parser", ",", "token", ")", ":", "parser", ".", "skip_past", "(", "'endcomment'", ")", "return", "CommentNode", "(", ")" ]
https://github.com/edisonlz/fastor/blob/342078a18363ac41d3c6b1ab29dbdd44fdb0b7b3/base/site-packages/django/template/defaulttags.py#L527-L532
pythad/nider
be71e09968559c5504c59158aa339136fb891fb4
nider/utils.py
python
is_path_creatable
(pathname)
return os.access(dirname, os.W_OK)
Function to check if the current user has sufficient permissions to create the passed pathname Args: pathname (str): path to check. Returns: bool: ``True`` if the current user has sufficient permissions to create the passed ``pathname``. ``False`` otherwise.
Function to check if the current user has sufficient permissions to create the passed pathname
[ "Function", "to", "check", "if", "the", "current", "user", "has", "sufficient", "permissions", "to", "create", "the", "passed", "pathname" ]
def is_path_creatable(pathname): '''Function to check if the current user has sufficient permissions to create the passed pathname Args: pathname (str): path to check. Returns: bool: ``True`` if the current user has sufficient permissions to create the passed ``pathname``. ``False`` ot...
[ "def", "is_path_creatable", "(", "pathname", ")", ":", "# Parent directory of the passed path. If empty, we substitute the current", "# working directory (CWD) instead.", "dirname", "=", "os", ".", "path", ".", "dirname", "(", "pathname", ")", "or", "os", ".", "getcwd", "...
https://github.com/pythad/nider/blob/be71e09968559c5504c59158aa339136fb891fb4/nider/utils.py#L40-L53
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/v1_taint.py
python
V1Taint.__ne__
(self, other)
return self.to_dict() != other.to_dict()
Returns true if both objects are not equal
Returns true if both objects are not equal
[ "Returns", "true", "if", "both", "objects", "are", "not", "equal" ]
def __ne__(self, other): """Returns true if both objects are not equal""" if not isinstance(other, V1Taint): return True return self.to_dict() != other.to_dict()
[ "def", "__ne__", "(", "self", ",", "other", ")", ":", "if", "not", "isinstance", "(", "other", ",", "V1Taint", ")", ":", "return", "True", "return", "self", ".", "to_dict", "(", ")", "!=", "other", ".", "to_dict", "(", ")" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/v1_taint.py#L203-L208
FORTH-ICS-INSPIRE/artemis
f0774af8abc25ef5c6b307960c048ff7528d8a9c
backend-services/fileobserver/core/observer.py
python
Handler.__init__
(self, d, fn)
[]
def __init__(self, d, fn): super().__init__() self.response = None self.path = "{}/{}".format(d, fn) try: with open(self.path, "r") as f: self.content = f.readlines() except Exception: log.exception("exception")
[ "def", "__init__", "(", "self", ",", "d", ",", "fn", ")", ":", "super", "(", ")", ".", "__init__", "(", ")", "self", ".", "response", "=", "None", "self", ".", "path", "=", "\"{}/{}\"", ".", "format", "(", "d", ",", "fn", ")", "try", ":", "with...
https://github.com/FORTH-ICS-INSPIRE/artemis/blob/f0774af8abc25ef5c6b307960c048ff7528d8a9c/backend-services/fileobserver/core/observer.py#L210-L218
krintoxi/NoobSec-Toolkit
38738541cbc03cedb9a3b3ed13b629f781ad64f6
NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_pslinux.py
python
per_cpu_times
()
Return a list of namedtuple representing the CPU times for every CPU available on the system.
Return a list of namedtuple representing the CPU times for every CPU available on the system.
[ "Return", "a", "list", "of", "namedtuple", "representing", "the", "CPU", "times", "for", "every", "CPU", "available", "on", "the", "system", "." ]
def per_cpu_times(): """Return a list of namedtuple representing the CPU times for every CPU available on the system. """ cpus = [] with open('/proc/stat', 'rb') as f: # get rid of the first line which refers to system wide CPU stats f.readline() for line in f: if...
[ "def", "per_cpu_times", "(", ")", ":", "cpus", "=", "[", "]", "with", "open", "(", "'/proc/stat'", ",", "'rb'", ")", "as", "f", ":", "# get rid of the first line which refers to system wide CPU stats", "f", ".", "readline", "(", ")", "for", "line", "in", "f", ...
https://github.com/krintoxi/NoobSec-Toolkit/blob/38738541cbc03cedb9a3b3ed13b629f781ad64f6/NoobSecToolkit - MAC OSX/scripts/sshbackdoors/backdoors/shell/pupy/pupy/packages/windows/amd64/psutil/_pslinux.py#L242-L257
DeNA/Chainer_Mask_R-CNN
315a5b09897801c1f6f21270aa898dc2c4d96c65
utils/roi_align_2d.py
python
roi_align_2d
(x, rois, outh, outw, spatial_scale)
return ROIAlign2D(outh, outw, spatial_scale)(x, rois)
Spatial Region of Interest (ROI) align function. This function acts similarly to :class:`~functions.MaxPooling2D`, but it computes the maximum of input spatial patch for each channel with the region of interest. Args: x (~chainer.Variable): Input variable. The shape is expected to be ...
Spatial Region of Interest (ROI) align function.
[ "Spatial", "Region", "of", "Interest", "(", "ROI", ")", "align", "function", "." ]
def roi_align_2d(x, rois, outh, outw, spatial_scale): """Spatial Region of Interest (ROI) align function. This function acts similarly to :class:`~functions.MaxPooling2D`, but it computes the maximum of input spatial patch for each channel with the region of interest. Args: x (~chainer.Var...
[ "def", "roi_align_2d", "(", "x", ",", "rois", ",", "outh", ",", "outw", ",", "spatial_scale", ")", ":", "return", "ROIAlign2D", "(", "outh", ",", "outw", ",", "spatial_scale", ")", "(", "x", ",", "rois", ")" ]
https://github.com/DeNA/Chainer_Mask_R-CNN/blob/315a5b09897801c1f6f21270aa898dc2c4d96c65/utils/roi_align_2d.py#L219-L243
jython/frozen-mirror
b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99
lib-python/2.7/hashlib.py
python
__hash_new
(name, string='')
new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string.
new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string.
[ "new", "(", "name", "string", "=", ")", "-", "Return", "a", "new", "hashing", "object", "using", "the", "named", "algorithm", ";", "optionally", "initialized", "with", "a", "string", "." ]
def __hash_new(name, string=''): """new(name, string='') - Return a new hashing object using the named algorithm; optionally initialized with a string. """ try: return _hashlib.new(name, string) except ValueError: # If the _hashlib module (OpenSSL) doesn't support the named #...
[ "def", "__hash_new", "(", "name", ",", "string", "=", "''", ")", ":", "try", ":", "return", "_hashlib", ".", "new", "(", "name", ",", "string", ")", "except", "ValueError", ":", "# If the _hashlib module (OpenSSL) doesn't support the named", "# hash, try using our b...
https://github.com/jython/frozen-mirror/blob/b8d7aa4cee50c0c0fe2f4b235dd62922dd0f3f99/lib-python/2.7/hashlib.py#L113-L124
mchristopher/PokemonGo-DesktopMap
ec37575f2776ee7d64456e2a1f6b6b78830b4fe0
app/pywin/Lib/distutils/msvccompiler.py
python
get_build_version
()
return None
Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6.
Return the version of MSVC that was used to build Python.
[ "Return", "the", "version", "of", "MSVC", "that", "was", "used", "to", "build", "Python", "." ]
def get_build_version(): """Return the version of MSVC that was used to build Python. For Python 2.3 and up, the version number is included in sys.version. For earlier versions, assume the compiler is MSVC 6. """ prefix = "MSC v." i = string.find(sys.version, prefix) if i == -1: r...
[ "def", "get_build_version", "(", ")", ":", "prefix", "=", "\"MSC v.\"", "i", "=", "string", ".", "find", "(", "sys", ".", "version", ",", "prefix", ")", "if", "i", "==", "-", "1", ":", "return", "6", "i", "=", "i", "+", "len", "(", "prefix", ")",...
https://github.com/mchristopher/PokemonGo-DesktopMap/blob/ec37575f2776ee7d64456e2a1f6b6b78830b4fe0/app/pywin/Lib/distutils/msvccompiler.py#L153-L174
ansible/ansible-runner-service
a9c7bd6174217bdc9c6d1e9e23fa74fe66a11d50
runner_service/controllers/vars.py
python
GroupVars.post
(self, group_name)
return r.__dict__, self.state_to_http[r.status]
POST [?type=file|inventory] Store group variables. By default, variables are stored in the group_vars subdirectory (type=file) but you may also store them in the inventory itself by specifying ?type=inventory on the request Example. ``` $ curl -i -k --key client.key --cert clie...
POST [?type=file|inventory] Store group variables. By default, variables are stored in the group_vars subdirectory (type=file) but you may also store them in the inventory itself by specifying ?type=inventory on the request
[ "POST", "[", "?type", "=", "file|inventory", "]", "Store", "group", "variables", ".", "By", "default", "variables", "are", "stored", "in", "the", "group_vars", "subdirectory", "(", "type", "=", "file", ")", "but", "you", "may", "also", "store", "them", "in...
def post(self, group_name): """ POST [?type=file|inventory] Store group variables. By default, variables are stored in the group_vars subdirectory (type=file) but you may also store them in the inventory itself by specifying ?type=inventory on the request Example. ``` ...
[ "def", "post", "(", "self", ",", "group_name", ")", ":", "# noqa", "r", "=", "APIResponse", "(", ")", "if", "request", ".", "content_type", "!=", "'application/json'", ":", "logger", ".", "warning", "(", "\"Invalid request. GROUPVARS POST requests must be \"", "\"...
https://github.com/ansible/ansible-runner-service/blob/a9c7bd6174217bdc9c6d1e9e23fa74fe66a11d50/runner_service/controllers/vars.py#L228-L295
fogleman/pg
124ea3803c788b2c98c4f3a428e5d26842a67b58
pg/glfw.py
python
set_cursor_pos
(window, xpos, ypos)
Sets the position of the cursor, relative to the client area of the window. Wrapper for: void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos);
Sets the position of the cursor, relative to the client area of the window.
[ "Sets", "the", "position", "of", "the", "cursor", "relative", "to", "the", "client", "area", "of", "the", "window", "." ]
def set_cursor_pos(window, xpos, ypos): ''' Sets the position of the cursor, relative to the client area of the window. Wrapper for: void glfwSetCursorPos(GLFWwindow* window, double xpos, double ypos); ''' _glfw.glfwSetCursorPos(window, xpos, ypos)
[ "def", "set_cursor_pos", "(", "window", ",", "xpos", ",", "ypos", ")", ":", "_glfw", ".", "glfwSetCursorPos", "(", "window", ",", "xpos", ",", "ypos", ")" ]
https://github.com/fogleman/pg/blob/124ea3803c788b2c98c4f3a428e5d26842a67b58/pg/glfw.py#L1306-L1313
justquick/django-varnish
05ae29ff870bc3cd08a91570b7e19f47c9d33929
varnishapp/management/commands/varnishmgt.py
python
Command.handle
(self, *args, **options)
[]
def handle(self, *args, **options): if args: pprint(manager.run(*args)) else: print manager.help()
[ "def", "handle", "(", "self", ",", "*", "args", ",", "*", "*", "options", ")", ":", "if", "args", ":", "pprint", "(", "manager", ".", "run", "(", "*", "args", ")", ")", "else", ":", "print", "manager", ".", "help", "(", ")" ]
https://github.com/justquick/django-varnish/blob/05ae29ff870bc3cd08a91570b7e19f47c9d33929/varnishapp/management/commands/varnishmgt.py#L6-L10
songwsx/person_search_demo
b4a23f222ed9c451f13673f861e562b1d9169791
utils/datasets.py
python
LoadImagesAndLabels.__init__
(self, path, img_size=416, batch_size=16, augment=False, hyp=None, rect=True, image_weights=False, cache_images=False)
:param path: 得到训练集的ID文件路径 'data/train.txt' :param img_size: 网络输入分辨率 416 :param batch_size: 2 :param augment: 是否进行数据增广 :param hyp: 数据增广的超参数 :param rect: 是否采用矩形训练 :param image_weights: False :param cache_images: True
[]
def __init__(self, path, img_size=416, batch_size=16, augment=False, hyp=None, rect=True, image_weights=False, cache_images=False): """ :param path: 得到训练集的ID文件路径 'data/train.txt' :param img_size: 网络输入分辨率 416 :param batch_size: 2 :param augment: 是否进行数据增广 ...
[ "def", "__init__", "(", "self", ",", "path", ",", "img_size", "=", "416", ",", "batch_size", "=", "16", ",", "augment", "=", "False", ",", "hyp", "=", "None", ",", "rect", "=", "True", ",", "image_weights", "=", "False", ",", "cache_images", "=", "Fa...
https://github.com/songwsx/person_search_demo/blob/b4a23f222ed9c451f13673f861e562b1d9169791/utils/datasets.py#L188-L323
punchagan/cinspect
23834b9d02511a88cba8ca0aa1397eef927822c3
cinspect/index/serialize.py
python
write_index
(db, data)
Read the index and return the data.
Read the index and return the data.
[ "Read", "the", "index", "and", "return", "the", "data", "." ]
def write_index(db, data): """ Read the index and return the data. """ with open(db, 'w') as f: json.dump(data, f, indent=2)
[ "def", "write_index", "(", "db", ",", "data", ")", ":", "with", "open", "(", "db", ",", "'w'", ")", "as", "f", ":", "json", ".", "dump", "(", "data", ",", "f", ",", "indent", "=", "2", ")" ]
https://github.com/punchagan/cinspect/blob/23834b9d02511a88cba8ca0aa1397eef927822c3/cinspect/index/serialize.py#L55-L59