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
hughw19/NOCS_CVPR2019
14dbce775c3c7c45bb7b19269bd53d68efb8f73f
utils.py
python
compute_coords_aps
(final_results, synset_names, iou_thresholds, coord_thresholds)
Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different class score thresholds. recalls: List of recall values at different class score thresholds. overlaps: [pred_boxes, gt_boxes] IoU overlaps.
Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different class score thresholds. recalls: List of recall values at different class score thresholds. overlaps: [pred_boxes, gt_boxes] IoU overlaps.
[ "Compute", "Average", "Precision", "at", "a", "set", "IoU", "threshold", "(", "default", "0", ".", "5", ")", ".", "Returns", ":", "mAP", ":", "Mean", "Average", "Precision", "precisions", ":", "List", "of", "precisions", "at", "different", "class", "score"...
def compute_coords_aps(final_results, synset_names, iou_thresholds, coord_thresholds): """Compute Average Precision at a set IoU threshold (default 0.5). Returns: mAP: Mean Average Precision precisions: List of precisions at different class score thresholds. recalls: List of recall values at differe...
[ "def", "compute_coords_aps", "(", "final_results", ",", "synset_names", ",", "iou_thresholds", ",", "coord_thresholds", ")", ":", "num_classes", "=", "len", "(", "synset_names", ")", "num_iou_thres", "=", "len", "(", "iou_thresholds", ")", "num_coord_thres", "=", ...
https://github.com/hughw19/NOCS_CVPR2019/blob/14dbce775c3c7c45bb7b19269bd53d68efb8f73f/utils.py#L2285-L2388
holzschu/Carnets
44effb10ddfc6aa5c8b0687582a724ba82c6b547
Library/lib/python3.7/_pyio.py
python
FileIO.seek
(self, pos, whence=SEEK_SET)
return os.lseek(self._fd, pos, whence)
Move to new file position. Argument offset is a byte count. Optional argument whence defaults to SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values are SEEK_CUR or 1 (move relative to current position, positive or negative), and SEEK_END or 2 (move relative ...
Move to new file position.
[ "Move", "to", "new", "file", "position", "." ]
def seek(self, pos, whence=SEEK_SET): """Move to new file position. Argument offset is a byte count. Optional argument whence defaults to SEEK_SET or 0 (offset from start of file, offset should be >= 0); other values are SEEK_CUR or 1 (move relative to current position, positive or neg...
[ "def", "seek", "(", "self", ",", "pos", ",", "whence", "=", "SEEK_SET", ")", ":", "if", "isinstance", "(", "pos", ",", "float", ")", ":", "raise", "TypeError", "(", "'an integer is required'", ")", "self", ".", "_checkClosed", "(", ")", "return", "os", ...
https://github.com/holzschu/Carnets/blob/44effb10ddfc6aa5c8b0687582a724ba82c6b547/Library/lib/python3.7/_pyio.py#L1649-L1663
MaurizioFD/RecSys2019_DeepLearning_Evaluation
0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b
Base/BaseRecommender.py
python
BaseRecommender._compute_item_score
(self, user_id_array, items_to_compute = None)
:param user_id_array: array containing the user indices whose recommendations need to be computed :param items_to_compute: array containing the items whose scores are to be computed. If None, all items are computed, otherwise discarded items will have as score -n...
[]
def _compute_item_score(self, user_id_array, items_to_compute = None): """ :param user_id_array: array containing the user indices whose recommendations need to be computed :param items_to_compute: array containing the items whose scores are to be computed. ...
[ "def", "_compute_item_score", "(", "self", ",", "user_id_array", ",", "items_to_compute", "=", "None", ")", ":", "raise", "NotImplementedError", "(", "\"BaseRecommender: compute_item_score not assigned for current recommender, unable to compute prediction scores\"", ")" ]
https://github.com/MaurizioFD/RecSys2019_DeepLearning_Evaluation/blob/0fb6b7f5c396f8525316ed66cf9c9fdb03a5fa9b/Base/BaseRecommender.py#L120-L128
broadinstitute/viral-ngs
e144969e4c57060d53f38a4c3a270e8227feace1
util/misc.py
python
load_yaml_or_json
(fname)
Load a dictionary from either a yaml or a json file
Load a dictionary from either a yaml or a json file
[ "Load", "a", "dictionary", "from", "either", "a", "yaml", "or", "a", "json", "file" ]
def load_yaml_or_json(fname): '''Load a dictionary from either a yaml or a json file''' with open(fname) as f: if fname.upper().endswith('.YAML'): return yaml.safe_load(f) or {} if fname.upper().endswith('.JSON'): return json.load(f) or {} raise TypeError('Unsupported dict file format: '...
[ "def", "load_yaml_or_json", "(", "fname", ")", ":", "with", "open", "(", "fname", ")", "as", "f", ":", "if", "fname", ".", "upper", "(", ")", ".", "endswith", "(", "'.YAML'", ")", ":", "return", "yaml", ".", "safe_load", "(", "f", ")", "or", "{", ...
https://github.com/broadinstitute/viral-ngs/blob/e144969e4c57060d53f38a4c3a270e8227feace1/util/misc.py#L493-L498
buke/GreenOdoo
3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df
runtime/python/lib/python2.7/site-packages/gevent/greenlet.py
python
Greenlet.start
(self)
Schedule the greenlet to run in this loop iteration
Schedule the greenlet to run in this loop iteration
[ "Schedule", "the", "greenlet", "to", "run", "in", "this", "loop", "iteration" ]
def start(self): """Schedule the greenlet to run in this loop iteration""" if self._start_event is None: self._start_event = self.parent.loop.run_callback(self.switch)
[ "def", "start", "(", "self", ")", ":", "if", "self", ".", "_start_event", "is", "None", ":", "self", ".", "_start_event", "=", "self", ".", "parent", ".", "loop", ".", "run_callback", "(", "self", ".", "switch", ")" ]
https://github.com/buke/GreenOdoo/blob/3d8c55d426fb41fdb3f2f5a1533cfe05983ba1df/runtime/python/lib/python2.7/site-packages/gevent/greenlet.py#L184-L187
leancloud/satori
701caccbd4fe45765001ca60435c0cb499477c03
satori-rules/plugin/libs/gevent/greenlet.py
python
Greenlet.__start_cancelled_by_kill
(self)
return self._start_event is _cancelled_start_event
[]
def __start_cancelled_by_kill(self): return self._start_event is _cancelled_start_event
[ "def", "__start_cancelled_by_kill", "(", "self", ")", ":", "return", "self", ".", "_start_event", "is", "_cancelled_start_event" ]
https://github.com/leancloud/satori/blob/701caccbd4fe45765001ca60435c0cb499477c03/satori-rules/plugin/libs/gevent/greenlet.py#L209-L210
cbrgm/telegram-robot-rss
58fe98de427121fdc152c8df0721f1891174e6c9
util/database.py
python
DatabaseHandler.add_user
(self, telegram_id, username, firstname, lastname, language_code, is_bot, is_active)
Adds a user to sqlite database Args: param1 (int): The telegram_id of a user. param2 (str): The username of a user. param3 (str): The firstname of a user. param4 (str): The lastname of a user. param5 (str): The language_code of a user. par...
Adds a user to sqlite database
[ "Adds", "a", "user", "to", "sqlite", "database" ]
def add_user(self, telegram_id, username, firstname, lastname, language_code, is_bot, is_active): """Adds a user to sqlite database Args: param1 (int): The telegram_id of a user. param2 (str): The username of a user. param3 (str): The firstname of a user. ...
[ "def", "add_user", "(", "self", ",", "telegram_id", ",", "username", ",", "firstname", ",", "lastname", ",", "language_code", ",", "is_bot", ",", "is_active", ")", ":", "conn", "=", "sqlite3", ".", "connect", "(", "self", ".", "database_path", ")", "cursor...
https://github.com/cbrgm/telegram-robot-rss/blob/58fe98de427121fdc152c8df0721f1891174e6c9/util/database.py#L22-L41
oilshell/oil
94388e7d44a9ad879b12615f6203b38596b5a2d3
Python-2.7.13/Lib/idlelib/PyShell.py
python
PyShell.open_stack_viewer
(self, event=None)
[]
def open_stack_viewer(self, event=None): if self.interp.rpcclt: return self.interp.remote_stack_viewer() try: sys.last_traceback except: tkMessageBox.showerror("No stack trace", "There is no stack trace yet.\n" "(sys.last_traceb...
[ "def", "open_stack_viewer", "(", "self", ",", "event", "=", "None", ")", ":", "if", "self", ".", "interp", ".", "rpcclt", ":", "return", "self", ".", "interp", ".", "remote_stack_viewer", "(", ")", "try", ":", "sys", ".", "last_traceback", "except", ":",...
https://github.com/oilshell/oil/blob/94388e7d44a9ad879b12615f6203b38596b5a2d3/Python-2.7.13/Lib/idlelib/PyShell.py#L1250-L1262
tijme/angularjs-csti-scanner
dcf5bf3d36a0a6ee3a9db1340e68de95b33e4615
acstis/actions/TraverseUrlAction.py
python
TraverseUrlAction.get_action_items_derived
(self)
return items
Get new queue items based on this action. Returns: list(:class:`nyawc.QueueItem`): A list of possibly vulnerable queue items.
Get new queue items based on this action.
[ "Get", "new", "queue", "items", "based", "on", "this", "action", "." ]
def get_action_items_derived(self): """Get new queue items based on this action. Returns: list(:class:`nyawc.QueueItem`): A list of possibly vulnerable queue items. """ items = [] path = self.get_parsed_url().path filename = self.get_filename() if...
[ "def", "get_action_items_derived", "(", "self", ")", ":", "items", "=", "[", "]", "path", "=", "self", ".", "get_parsed_url", "(", ")", ".", "path", "filename", "=", "self", ".", "get_filename", "(", ")", "if", "filename", ":", "path", "[", "0", ":", ...
https://github.com/tijme/angularjs-csti-scanner/blob/dcf5bf3d36a0a6ee3a9db1340e68de95b33e4615/acstis/actions/TraverseUrlAction.py#L47-L86
nwcell/psycopg2-windows
5698844286001962f3eeeab58164301898ef48e9
psycopg2/_range.py
python
RangeCaster._from_db
(self, name, pyrange, conn_or_curs)
return RangeCaster(name, pyrange, oid=type, subtype_oid=subtype, array_oid=array)
Return a `RangeCaster` instance for the type *pgrange*. Raise `ProgrammingError` if the type is not found.
Return a `RangeCaster` instance for the type *pgrange*.
[ "Return", "a", "RangeCaster", "instance", "for", "the", "type", "*", "pgrange", "*", "." ]
def _from_db(self, name, pyrange, conn_or_curs): """Return a `RangeCaster` instance for the type *pgrange*. Raise `ProgrammingError` if the type is not found. """ from psycopg2.extensions import STATUS_IN_TRANSACTION from psycopg2.extras import _solve_conn_curs conn, cur...
[ "def", "_from_db", "(", "self", ",", "name", ",", "pyrange", ",", "conn_or_curs", ")", ":", "from", "psycopg2", ".", "extensions", "import", "STATUS_IN_TRANSACTION", "from", "psycopg2", ".", "extras", "import", "_solve_conn_curs", "conn", ",", "curs", "=", "_s...
https://github.com/nwcell/psycopg2-windows/blob/5698844286001962f3eeeab58164301898ef48e9/psycopg2/_range.py#L310-L363
Source-Python-Dev-Team/Source.Python
d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb
addons/source-python/Python3/calendar.py
python
Calendar.yeardayscalendar
(self, year, width=3)
return [months[i:i+width] for i in range(0, len(months), width) ]
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero.
Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero.
[ "Return", "the", "data", "for", "the", "specified", "year", "ready", "for", "formatting", "(", "similar", "to", "yeardatescalendar", "()", ")", ".", "Entries", "in", "the", "week", "lists", "are", "day", "numbers", ".", "Day", "numbers", "outside", "this", ...
def yeardayscalendar(self, year, width=3): """ Return the data for the specified year ready for formatting (similar to yeardatescalendar()). Entries in the week lists are day numbers. Day numbers outside this month are zero. """ months = [ self.monthdayscalend...
[ "def", "yeardayscalendar", "(", "self", ",", "year", ",", "width", "=", "3", ")", ":", "months", "=", "[", "self", ".", "monthdayscalendar", "(", "year", ",", "i", ")", "for", "i", "in", "range", "(", "January", ",", "January", "+", "12", ")", "]",...
https://github.com/Source-Python-Dev-Team/Source.Python/blob/d0ffd8ccbd1e9923c9bc44936f20613c1c76b7fb/addons/source-python/Python3/calendar.py#L247-L257
Floobits/flootty
731fb4516da3ad34c724440787e57c97229838e8
flootty/floo/common/lib/diff_match_patch.py
python
diff_match_patch.diff_halfMatch
(self, text1, text2)
return (text1_a, text1_b, text2_a, text2_b, mid_common)
Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs. Args: text1: First string. text2: Second string. Returns: Five element Array, containing the prefix of text1, the suf...
Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs.
[ "Do", "the", "two", "texts", "share", "a", "substring", "which", "is", "at", "least", "half", "the", "length", "of", "the", "longer", "text?", "This", "speedup", "can", "produce", "non", "-", "minimal", "diffs", "." ]
def diff_halfMatch(self, text1, text2): """Do the two texts share a substring which is at least half the length of the longer text? This speedup can produce non-minimal diffs. Args: text1: First string. text2: Second string. Returns: Five ele...
[ "def", "diff_halfMatch", "(", "self", ",", "text1", ",", "text2", ")", ":", "if", "self", ".", "Diff_Timeout", "<=", "0", ":", "# Don't risk returning a non-optimal diff if we have unlimited time.", "return", "None", "if", "len", "(", "text1", ")", ">", "len", "...
https://github.com/Floobits/flootty/blob/731fb4516da3ad34c724440787e57c97229838e8/flootty/floo/common/lib/diff_match_patch.py#L565-L646
gramps-project/gramps
04d4651a43eb210192f40a9f8c2bad8ee8fa3753
gramps/plugins/textreport/detancestralreport.py
python
DetAncestorReport.write_marriage
(self, person)
Output marriage sentence.
Output marriage sentence.
[ "Output", "marriage", "sentence", "." ]
def write_marriage(self, person): """ Output marriage sentence. """ is_first = True for family_handle in person.get_family_handle_list(): family = self._db.get_family_from_handle(family_handle) spouse_handle = utils.find_spouse(person, family) ...
[ "def", "write_marriage", "(", "self", ",", "person", ")", ":", "is_first", "=", "True", "for", "family_handle", "in", "person", ".", "get_family_handle_list", "(", ")", ":", "family", "=", "self", ".", "_db", ".", "get_family_from_handle", "(", "family_handle"...
https://github.com/gramps-project/gramps/blob/04d4651a43eb210192f40a9f8c2bad8ee8fa3753/gramps/plugins/textreport/detancestralreport.py#L551-L572
snakemake/snakemake
987282dde8a2db5174414988c134a39ae8836a61
snakemake/benchmark.py
python
BenchmarkTimer._update_record
(self)
Perform the actual measurement
Perform the actual measurement
[ "Perform", "the", "actual", "measurement" ]
def _update_record(self): """Perform the actual measurement""" import psutil # Memory measurements rss, vms, uss, pss = 0, 0, 0, 0 # I/O measurements io_in, io_out = 0, 0 check_io = True # CPU seconds cpu_usages = 0 # CPU usage time ...
[ "def", "_update_record", "(", "self", ")", ":", "import", "psutil", "# Memory measurements", "rss", ",", "vms", ",", "uss", ",", "pss", "=", "0", ",", "0", ",", "0", ",", "0", "# I/O measurements", "io_in", ",", "io_out", "=", "0", ",", "0", "check_io"...
https://github.com/snakemake/snakemake/blob/987282dde8a2db5174414988c134a39ae8836a61/snakemake/benchmark.py#L215-L287
frappe/frappe
b64cab6867dfd860f10ccaf41a4ec04bc890b583
frappe/sessions.py
python
Session.start
(self)
start a new session
start a new session
[ "start", "a", "new", "session" ]
def start(self): """start a new session""" # generate sid if self.user=='Guest': sid = 'Guest' else: sid = frappe.generate_hash() self.data.user = self.user self.data.sid = sid self.data.data.user = self.user self.data.data.session_ip = frappe.local.request_ip if self.user != "Guest": self.d...
[ "def", "start", "(", "self", ")", ":", "# generate sid", "if", "self", ".", "user", "==", "'Guest'", ":", "sid", "=", "'Guest'", "else", ":", "sid", "=", "frappe", ".", "generate_hash", "(", ")", "self", ".", "data", ".", "user", "=", "self", ".", ...
https://github.com/frappe/frappe/blob/b64cab6867dfd860f10ccaf41a4ec04bc890b583/frappe/sessions.py#L214-L254
replit-archive/empythoned
977ec10ced29a3541a4973dc2b59910805695752
dist/lib/python2.7/SimpleXMLRPCServer.py
python
SimpleXMLRPCDispatcher.register_instance
(self, instance, allow_dotted_names=False)
Registers an instance to respond to XML-RPC requests. Only one instance can be installed at a time. If the registered instance has a _dispatch method then that method will be called with the name of the XML-RPC method and its parameters as a tuple e.g. instance._dispatch('add',...
Registers an instance to respond to XML-RPC requests.
[ "Registers", "an", "instance", "to", "respond", "to", "XML", "-", "RPC", "requests", "." ]
def register_instance(self, instance, allow_dotted_names=False): """Registers an instance to respond to XML-RPC requests. Only one instance can be installed at a time. If the registered instance has a _dispatch method then that method will be called with the name of the XML-RPC method ...
[ "def", "register_instance", "(", "self", ",", "instance", ",", "allow_dotted_names", "=", "False", ")", ":", "self", ".", "instance", "=", "instance", "self", ".", "allow_dotted_names", "=", "allow_dotted_names" ]
https://github.com/replit-archive/empythoned/blob/977ec10ced29a3541a4973dc2b59910805695752/dist/lib/python2.7/SimpleXMLRPCServer.py#L175-L209
openshift/openshift-tools
1188778e728a6e4781acf728123e5b356380fe6f
openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/oo_iam_kms.py
python
AwsIamKms.get_all_kms_info
(self)
return aliases
fetch all kms info and return them list_keys doesn't have information regarding aliases list_aliases doesn't have the full kms arn fetch both and join them on the targetKeyId
fetch all kms info and return them
[ "fetch", "all", "kms", "info", "and", "return", "them" ]
def get_all_kms_info(self): '''fetch all kms info and return them list_keys doesn't have information regarding aliases list_aliases doesn't have the full kms arn fetch both and join them on the targetKeyId ''' aliases = self.kms_client.list_aliases()['Aliases'] ...
[ "def", "get_all_kms_info", "(", "self", ")", ":", "aliases", "=", "self", ".", "kms_client", ".", "list_aliases", "(", ")", "[", "'Aliases'", "]", "keys", "=", "self", ".", "kms_client", ".", "list_keys", "(", ")", "[", "'Keys'", "]", "for", "alias", "...
https://github.com/openshift/openshift-tools/blob/1188778e728a6e4781acf728123e5b356380fe6f/openshift/installer/vendored/openshift-ansible-3.9.40/roles/lib_utils/library/oo_iam_kms.py#L55-L72
LexPredict/openedgar
1d1b8bc8faa3c59e05d9883e53039b6328b7d831
lexpredict_openedgar/openedgar/tasks.py
python
create_filing_error
(row, filing_path: str)
return True
Create a Filing error record from an index row. :param row: :param filing_path: :return:
Create a Filing error record from an index row. :param row: :param filing_path: :return:
[ "Create", "a", "Filing", "error", "record", "from", "an", "index", "row", ".", ":", "param", "row", ":", ":", "param", "filing_path", ":", ":", "return", ":" ]
def create_filing_error(row, filing_path: str): """ Create a Filing error record from an index row. :param row: :param filing_path: :return: """ # Get vars cik = row["CIK"] company_name = row["Company Name"] form_type = row["Form Type"] try: date_filed = dateutil.par...
[ "def", "create_filing_error", "(", "row", ",", "filing_path", ":", "str", ")", ":", "# Get vars", "cik", "=", "row", "[", "\"CIK\"", "]", "company_name", "=", "row", "[", "\"Company Name\"", "]", "form_type", "=", "row", "[", "\"Form Type\"", "]", "try", "...
https://github.com/LexPredict/openedgar/blob/1d1b8bc8faa3c59e05d9883e53039b6328b7d831/lexpredict_openedgar/openedgar/tasks.py#L119-L185
adamcaudill/EquationGroupLeak
52fa871c89008566c27159bd48f2a8641260c984
Firewall/EXPLOITS/EPBA/EPICBANANA/pexpect.py
python
spawn.sendintr
(self)
This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line.
This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line.
[ "This", "sends", "a", "SIGINT", "to", "the", "child", ".", "It", "does", "not", "require", "the", "SIGINT", "to", "be", "the", "first", "character", "on", "a", "line", "." ]
def sendintr(self): """This sends a SIGINT to the child. It does not require the SIGINT to be the first character on a line. """ if hasattr(termios, 'VINTR'): char = termios.tcgetattr(self.child_fd)[6][termios.VINTR] else: # platform does not define VINTR so ass...
[ "def", "sendintr", "(", "self", ")", ":", "if", "hasattr", "(", "termios", ",", "'VINTR'", ")", ":", "char", "=", "termios", ".", "tcgetattr", "(", "self", ".", "child_fd", ")", "[", "6", "]", "[", "termios", ".", "VINTR", "]", "else", ":", "# plat...
https://github.com/adamcaudill/EquationGroupLeak/blob/52fa871c89008566c27159bd48f2a8641260c984/Firewall/EXPLOITS/EPBA/EPICBANANA/pexpect.py#L1025-L1035
ynhacler/RedKindle
7c970920dc840f869e38cbda480d630cc2e7b200
web/template.py
python
TemplateResult._prepare_body
(self)
Prepare value of __body__ by joining parts.
Prepare value of __body__ by joining parts.
[ "Prepare", "value", "of", "__body__", "by", "joining", "parts", "." ]
def _prepare_body(self): """Prepare value of __body__ by joining parts. """ if self._parts: value = u"".join(self._parts) self._parts[:] = [] body = self._d.get('__body__') if body: self._d['__body__'] = body + value els...
[ "def", "_prepare_body", "(", "self", ")", ":", "if", "self", ".", "_parts", ":", "value", "=", "u\"\"", ".", "join", "(", "self", ".", "_parts", ")", "self", ".", "_parts", "[", ":", "]", "=", "[", "]", "body", "=", "self", ".", "_d", ".", "get...
https://github.com/ynhacler/RedKindle/blob/7c970920dc840f869e38cbda480d630cc2e7b200/web/template.py#L1250-L1260
tf-encrypted/tf-encrypted
8b7cfb32c426e9a6f56769a1b47626bd1be03a66
tf_encrypted/protocol/pond/pond.py
python
PondTensor.add
(self, other)
return self.prot.add(self, other)
Add `other` to this PondTensor. This can be another tensor with the same backing or a primitive. This function returns a new PondTensor and does not modify this one. :param PondTensor other: a or primitive (e.g. a float) :return: A new PondTensor with `other` added. :rtype: PondTensor
Add `other` to this PondTensor. This can be another tensor with the same backing or a primitive.
[ "Add", "other", "to", "this", "PondTensor", ".", "This", "can", "be", "another", "tensor", "with", "the", "same", "backing", "or", "a", "primitive", "." ]
def add(self, other): """ Add `other` to this PondTensor. This can be another tensor with the same backing or a primitive. This function returns a new PondTensor and does not modify this one. :param PondTensor other: a or primitive (e.g. a float) :return: A new PondTensor with `other` add...
[ "def", "add", "(", "self", ",", "other", ")", ":", "return", "self", ".", "prot", ".", "add", "(", "self", ",", "other", ")" ]
https://github.com/tf-encrypted/tf-encrypted/blob/8b7cfb32c426e9a6f56769a1b47626bd1be03a66/tf_encrypted/protocol/pond/pond.py#L1658-L1669
niftools/blender_niftools_addon
fc28f567e1fa431ec6633cb2a138898136090b29
io_scene_niftools/modules/nif_export/animation/transform.py
python
TransformAnimation.export_transforms
(self, parent_block, b_obj, b_action, bone=None)
If bone == None, object level animation is exported. If a bone is given, skeletal animation is exported.
If bone == None, object level animation is exported. If a bone is given, skeletal animation is exported.
[ "If", "bone", "==", "None", "object", "level", "animation", "is", "exported", ".", "If", "a", "bone", "is", "given", "skeletal", "animation", "is", "exported", "." ]
def export_transforms(self, parent_block, b_obj, b_action, bone=None): """ If bone == None, object level animation is exported. If a bone is given, skeletal animation is exported. """ # b_action may be None, then nothing is done. if not b_action: return ...
[ "def", "export_transforms", "(", "self", ",", "parent_block", ",", "b_obj", ",", "b_action", ",", "bone", "=", "None", ")", ":", "# b_action may be None, then nothing is done.", "if", "not", "b_action", ":", "return", "# blender object must exist", "assert", "b_obj", ...
https://github.com/niftools/blender_niftools_addon/blob/fc28f567e1fa431ec6633cb2a138898136090b29/io_scene_niftools/modules/nif_export/animation/transform.py#L122-L275
statsmodels/statsmodels
debbe7ea6ba28fe5bdb78f09f8cac694bef98722
statsmodels/tsa/statespace/mlemodel.py
python
MLEModel.clone
(self, endog, exog=None, **kwargs)
Clone state space model with new data and optionally new specification Parameters ---------- endog : array_like The observed time-series process :math:`y` k_states : int The dimension of the unobserved state process. exog : array_like, optional ...
Clone state space model with new data and optionally new specification
[ "Clone", "state", "space", "model", "with", "new", "data", "and", "optionally", "new", "specification" ]
def clone(self, endog, exog=None, **kwargs): """ Clone state space model with new data and optionally new specification Parameters ---------- endog : array_like The observed time-series process :math:`y` k_states : int The dimension of the unobser...
[ "def", "clone", "(", "self", ",", "endog", ",", "exog", "=", "None", ",", "*", "*", "kwargs", ")", ":", "raise", "NotImplementedError", "(", "'This method is not implemented in the base'", "' class and must be set up by each specific'", "' model.'", ")" ]
https://github.com/statsmodels/statsmodels/blob/debbe7ea6ba28fe5bdb78f09f8cac694bef98722/statsmodels/tsa/statespace/mlemodel.py#L254-L281
awslabs/aws-config-rules
8dfeacf9d9e5e5f0fbb1b8545ff702dea700ea7a
python/EMR_KERBEROS_ENABLED/EMR_KERBEROS_ENABLED.py
python
get_client
(service, event)
return boto3.client(service, aws_access_key_id=credentials['AccessKeyId'], aws_secret_access_key=credentials['SecretAccessKey'], aws_session_token=credentials['SessionToken'] )
Return the service boto client. It should be used instead of directly calling the client. Keyword arguments: service -- the service name used for calling the boto.client() event -- the event variable given in the lambda handler
Return the service boto client. It should be used instead of directly calling the client.
[ "Return", "the", "service", "boto", "client", ".", "It", "should", "be", "used", "instead", "of", "directly", "calling", "the", "client", "." ]
def get_client(service, event): """Return the service boto client. It should be used instead of directly calling the client. Keyword arguments: service -- the service name used for calling the boto.client() event -- the event variable given in the lambda handler """ if not ASSUME_ROLE_MODE: ...
[ "def", "get_client", "(", "service", ",", "event", ")", ":", "if", "not", "ASSUME_ROLE_MODE", ":", "return", "boto3", ".", "client", "(", "service", ")", "credentials", "=", "get_assume_role_credentials", "(", "event", "[", "\"executionRoleArn\"", "]", ")", "r...
https://github.com/awslabs/aws-config-rules/blob/8dfeacf9d9e5e5f0fbb1b8545ff702dea700ea7a/python/EMR_KERBEROS_ENABLED/EMR_KERBEROS_ENABLED.py#L269-L282
pycrypto/pycrypto
7acba5f3a6ff10f1424c309d0d34d2b713233019
lib/Crypto/Hash/HMAC.py
python
HMAC.digest
(self)
return h.digest()
Return the **binary** (non-printable) MAC of the message that has been authenticated so far. This method does not change the state of the MAC object. You can continue updating the object after calling this function. :Return: A byte string of `digest_size` bytes. It may contain ...
Return the **binary** (non-printable) MAC of the message that has been authenticated so far.
[ "Return", "the", "**", "binary", "**", "(", "non", "-", "printable", ")", "MAC", "of", "the", "message", "that", "has", "been", "authenticated", "so", "far", "." ]
def digest(self): """Return the **binary** (non-printable) MAC of the message that has been authenticated so far. This method does not change the state of the MAC object. You can continue updating the object after calling this function. :Return: A byte string of `digest...
[ "def", "digest", "(", "self", ")", ":", "h", "=", "self", ".", "outer", ".", "copy", "(", ")", "h", ".", "update", "(", "self", ".", "inner", ".", "digest", "(", ")", ")", "return", "h", ".", "digest", "(", ")" ]
https://github.com/pycrypto/pycrypto/blob/7acba5f3a6ff10f1424c309d0d34d2b713233019/lib/Crypto/Hash/HMAC.py#L184-L197
wucng/TensorExpand
4ea58f64f5c5082b278229b799c9f679536510b7
TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/lib/datasets/pascal_voc2.py
python
pascal_voc._load_rpn_roidb
(self, gt_roidb, model)
return self.create_roidb_from_box_list(box_list, gt_roidb)
[]
def _load_rpn_roidb(self, gt_roidb, model): # set the prefix if self._image_set == 'test': prefix = model + '/testing' else: prefix = model + '/training' box_list = [] for index in self.image_index: filename = os.path.join(self._pascal_path, '...
[ "def", "_load_rpn_roidb", "(", "self", ",", "gt_roidb", ",", "model", ")", ":", "# set the prefix", "if", "self", ".", "_image_set", "==", "'test'", ":", "prefix", "=", "model", "+", "'/testing'", "else", ":", "prefix", "=", "model", "+", "'/training'", "b...
https://github.com/wucng/TensorExpand/blob/4ea58f64f5c5082b278229b799c9f679536510b7/TensorExpand/Object detection/faster rcnn/CharlesShang-TFFRCNN-master/lib/datasets/pascal_voc2.py#L478-L507
skyfielders/python-skyfield
0e68757a5c1081f784c58fd7a76635c6deb98451
skyfield/timelib.py
python
Time.gmst
(self)
return sidereal_time(self)
Greenwich Mean Sidereal Time (GMST) in hours.
Greenwich Mean Sidereal Time (GMST) in hours.
[ "Greenwich", "Mean", "Sidereal", "Time", "(", "GMST", ")", "in", "hours", "." ]
def gmst(self): """Greenwich Mean Sidereal Time (GMST) in hours.""" return sidereal_time(self)
[ "def", "gmst", "(", "self", ")", ":", "return", "sidereal_time", "(", "self", ")" ]
https://github.com/skyfielders/python-skyfield/blob/0e68757a5c1081f784c58fd7a76635c6deb98451/skyfield/timelib.py#L824-L826
4shadoww/hakkuframework
409a11fc3819d251f86faa3473439f8c19066a21
lib/dns/rrset.py
python
RRset.match
(self, *args, **kwargs)
Does this rrset match the specified attributes? Behaves as :py:func:`full_match()` if the first argument is a ``dns.name.Name``, and as :py:func:`dns.rdataset.Rdataset.match()` otherwise. (This behavior fixes a design mistake where the signature of this method became incompatib...
Does this rrset match the specified attributes?
[ "Does", "this", "rrset", "match", "the", "specified", "attributes?" ]
def match(self, *args, **kwargs): """Does this rrset match the specified attributes? Behaves as :py:func:`full_match()` if the first argument is a ``dns.name.Name``, and as :py:func:`dns.rdataset.Rdataset.match()` otherwise. (This behavior fixes a design mistake where the signa...
[ "def", "match", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "isinstance", "(", "args", "[", "0", "]", ",", "dns", ".", "name", ".", "Name", ")", ":", "return", "self", ".", "full_match", "(", "*", "args", ",", "*", ...
https://github.com/4shadoww/hakkuframework/blob/409a11fc3819d251f86faa3473439f8c19066a21/lib/dns/rrset.py#L79-L94
yuxiaokui/Intranet-Penetration
f57678a204840c83cbf3308e3470ae56c5ff514b
proxy/XX-Net/code/default/python27/1.0/lib/email/message.py
python
Message.get_charset
(self)
return self._charset
Return the Charset instance associated with the message's payload.
Return the Charset instance associated with the message's payload.
[ "Return", "the", "Charset", "instance", "associated", "with", "the", "message", "s", "payload", "." ]
def get_charset(self): """Return the Charset instance associated with the message's payload. """ return self._charset
[ "def", "get_charset", "(", "self", ")", ":", "return", "self", ".", "_charset" ]
https://github.com/yuxiaokui/Intranet-Penetration/blob/f57678a204840c83cbf3308e3470ae56c5ff514b/proxy/XX-Net/code/default/python27/1.0/lib/email/message.py#L273-L276
Chaffelson/nipyapi
d3b186fd701ce308c2812746d98af9120955e810
nipyapi/nifi/models/processor_diagnostics_entity.py
python
ProcessorDiagnosticsEntity.uri
(self, uri)
Sets the uri of this ProcessorDiagnosticsEntity. The URI for futures requests to the component. :param uri: The uri of this ProcessorDiagnosticsEntity. :type: str
Sets the uri of this ProcessorDiagnosticsEntity. The URI for futures requests to the component.
[ "Sets", "the", "uri", "of", "this", "ProcessorDiagnosticsEntity", ".", "The", "URI", "for", "futures", "requests", "to", "the", "component", "." ]
def uri(self, uri): """ Sets the uri of this ProcessorDiagnosticsEntity. The URI for futures requests to the component. :param uri: The uri of this ProcessorDiagnosticsEntity. :type: str """ self._uri = uri
[ "def", "uri", "(", "self", ",", "uri", ")", ":", "self", ".", "_uri", "=", "uri" ]
https://github.com/Chaffelson/nipyapi/blob/d3b186fd701ce308c2812746d98af9120955e810/nipyapi/nifi/models/processor_diagnostics_entity.py#L144-L153
python-diamond/Diamond
7000e16cfdf4508ed9291fc4b3800592557b2431
src/collectors/iodrivesnmp/iodrivesnmp.py
python
IODriveSNMPCollector.get_bytes
(self, s)
return struct.unpack('%sB' % len(s), s)
Turns a string into a list of byte values
Turns a string into a list of byte values
[ "Turns", "a", "string", "into", "a", "list", "of", "byte", "values" ]
def get_bytes(self, s): """Turns a string into a list of byte values""" return struct.unpack('%sB' % len(s), s)
[ "def", "get_bytes", "(", "self", ",", "s", ")", ":", "return", "struct", ".", "unpack", "(", "'%sB'", "%", "len", "(", "s", ")", ",", "s", ")" ]
https://github.com/python-diamond/Diamond/blob/7000e16cfdf4508ed9291fc4b3800592557b2431/src/collectors/iodrivesnmp/iodrivesnmp.py#L94-L96
glitchdotcom/WebPutty
4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7
ziplibs/wtforms/ext/appengine/db.py
python
convert_EmailProperty
(model, prop, kwargs)
return get_TextField(kwargs)
Returns a form field for a ``db.EmailProperty``.
Returns a form field for a ``db.EmailProperty``.
[ "Returns", "a", "form", "field", "for", "a", "db", ".", "EmailProperty", "." ]
def convert_EmailProperty(model, prop, kwargs): """Returns a form field for a ``db.EmailProperty``.""" kwargs['validators'].append(validators.email()) return get_TextField(kwargs)
[ "def", "convert_EmailProperty", "(", "model", ",", "prop", ",", "kwargs", ")", ":", "kwargs", "[", "'validators'", "]", ".", "append", "(", "validators", ".", "email", "(", ")", ")", "return", "get_TextField", "(", "kwargs", ")" ]
https://github.com/glitchdotcom/WebPutty/blob/4f5da5eb2b4668cbf3c15cf002feacd1d95d2ef7/ziplibs/wtforms/ext/appengine/db.py#L217-L220
Azure/azure-devops-cli-extension
11334cd55806bef0b99c3bee5a438eed71e44037
azure-devops/azext_devops/dev/team/user.py
python
update_user_entitlement
(user, license_type, organization=None, detect=None)
return user_entitlement_update.user_entitlement
Update license type for a user. :param user: Email ID or ID of the user. :type user: str :param license_type: License type for the user. :type license_type: str :rtype: UserEntitlementsPatchResponse
Update license type for a user. :param user: Email ID or ID of the user. :type user: str :param license_type: License type for the user. :type license_type: str :rtype: UserEntitlementsPatchResponse
[ "Update", "license", "type", "for", "a", "user", ".", ":", "param", "user", ":", "Email", "ID", "or", "ID", "of", "the", "user", ".", ":", "type", "user", ":", "str", ":", "param", "license_type", ":", "License", "type", "for", "the", "user", ".", ...
def update_user_entitlement(user, license_type, organization=None, detect=None): """Update license type for a user. :param user: Email ID or ID of the user. :type user: str :param license_type: License type for the user. :type license_type: str :rtype: UserEntitlementsPatchResponse """ p...
[ "def", "update_user_entitlement", "(", "user", ",", "license_type", ",", "organization", "=", "None", ",", "detect", "=", "None", ")", ":", "patch_document", "=", "[", "]", "value", "=", "{", "}", "value", "[", "'accountLicenseType'", "]", "=", "license_type...
https://github.com/Azure/azure-devops-cli-extension/blob/11334cd55806bef0b99c3bee5a438eed71e44037/azure-devops/azext_devops/dev/team/user.py#L54-L74
isce-framework/isce2
0e5114a8bede3caf1d533d98e44dfe4b983e3f48
contrib/geo_autoRIFT/geogrid/GeogridOptical.py
python
GeogridOptical.finalize
(self)
Clean up all the C pointers.
Clean up all the C pointers.
[ "Clean", "up", "all", "the", "C", "pointers", "." ]
def finalize(self): ''' Clean up all the C pointers. ''' from . import geogridOptical geogridOptical.destroyGeoGridOptical_Py(self._geogridOptical) self._geogridOptical = None
[ "def", "finalize", "(", "self", ")", ":", "from", ".", "import", "geogridOptical", "geogridOptical", ".", "destroyGeoGridOptical_Py", "(", "self", ".", "_geogridOptical", ")", "self", ".", "_geogridOptical", "=", "None" ]
https://github.com/isce-framework/isce2/blob/0e5114a8bede3caf1d533d98e44dfe4b983e3f48/contrib/geo_autoRIFT/geogrid/GeogridOptical.py#L259-L267
natashamjaques/neural_chat
ddb977bb4602a67c460d02231e7bbf7b2cb49a97
ParlAI/parlai/mturk/core/legacy_2018/agents.py
python
MTurkAgent.wait_completion_timeout
(self, iterations)
return
Suspends the thread waiting for hit completion for some number of iterations on the THREAD_MTURK_POLLING_SLEEP time
Suspends the thread waiting for hit completion for some number of iterations on the THREAD_MTURK_POLLING_SLEEP time
[ "Suspends", "the", "thread", "waiting", "for", "hit", "completion", "for", "some", "number", "of", "iterations", "on", "the", "THREAD_MTURK_POLLING_SLEEP", "time" ]
def wait_completion_timeout(self, iterations): """Suspends the thread waiting for hit completion for some number of iterations on the THREAD_MTURK_POLLING_SLEEP time""" # Determine number of sleep iterations for the amount of time # we want to wait before syncing with MTurk. Start with ...
[ "def", "wait_completion_timeout", "(", "self", ",", "iterations", ")", ":", "# Determine number of sleep iterations for the amount of time", "# we want to wait before syncing with MTurk. Start with 10 seconds", "# of waiting", "iters", "=", "(", "shared_utils", ".", "THREAD_MTURK_POL...
https://github.com/natashamjaques/neural_chat/blob/ddb977bb4602a67c460d02231e7bbf7b2cb49a97/ParlAI/parlai/mturk/core/legacy_2018/agents.py#L569-L584
cloudera/hue
23f02102d4547c17c32bd5ea0eb24e9eadd657a4
desktop/core/ext-py/xlrd-2.0.1/xlrd/__init__.py
python
dump
(filename, outfile=sys.stdout, unnumbered=False)
For debugging: dump an XLS file's BIFF records in char & hex. :param filename: The path to the file to be dumped. :param outfile: An open file, to which the dump is written. :param unnumbered: If true, omit offsets (for meaningful diffs).
For debugging: dump an XLS file's BIFF records in char & hex.
[ "For", "debugging", ":", "dump", "an", "XLS", "file", "s", "BIFF", "records", "in", "char", "&", "hex", "." ]
def dump(filename, outfile=sys.stdout, unnumbered=False): """ For debugging: dump an XLS file's BIFF records in char & hex. :param filename: The path to the file to be dumped. :param outfile: An open file, to which the dump is written. :param unnumbered: If true, omit offsets (for meaningful diffs)...
[ "def", "dump", "(", "filename", ",", "outfile", "=", "sys", ".", "stdout", ",", "unnumbered", "=", "False", ")", ":", "from", ".", "biffh", "import", "biff_dump", "bk", "=", "Book", "(", ")", "bk", ".", "biff2_8_load", "(", "filename", "=", "filename",...
https://github.com/cloudera/hue/blob/23f02102d4547c17c32bd5ea0eb24e9eadd657a4/desktop/core/ext-py/xlrd-2.0.1/xlrd/__init__.py#L188-L199
OCA/l10n-brazil
6faefc04c7b0de3de3810a7ab137493d933fb579
l10n_br_stock/hooks.py
python
pre_init_hook
(cr)
Import XML data to change core data
Import XML data to change core data
[ "Import", "XML", "data", "to", "change", "core", "data" ]
def pre_init_hook(cr): """Import XML data to change core data""" if not tools.config["without_demo"]: _logger.info(_("Loading l10n_br_stock warehouse external ids...")) with api.Environment.manage(): env = api.Environment(cr, SUPERUSER_ID, {}) set_stock_warehouse_externa...
[ "def", "pre_init_hook", "(", "cr", ")", ":", "if", "not", "tools", ".", "config", "[", "\"without_demo\"", "]", ":", "_logger", ".", "info", "(", "_", "(", "\"Loading l10n_br_stock warehouse external ids...\"", ")", ")", "with", "api", ".", "Environment", ".",...
https://github.com/OCA/l10n-brazil/blob/6faefc04c7b0de3de3810a7ab137493d933fb579/l10n_br_stock/hooks.py#L84-L96
keras-team/keras-applications
bc89834ed36935ab4a4994446e34ff81c0d8e1b7
keras_applications/mobilenet.py
python
preprocess_input
(x, **kwargs)
return imagenet_utils.preprocess_input(x, mode='tf', **kwargs)
Preprocesses a numpy array encoding a batch of images. # Arguments x: a 4D numpy array consists of RGB values within [0, 255]. # Returns Preprocessed array.
Preprocesses a numpy array encoding a batch of images.
[ "Preprocesses", "a", "numpy", "array", "encoding", "a", "batch", "of", "images", "." ]
def preprocess_input(x, **kwargs): """Preprocesses a numpy array encoding a batch of images. # Arguments x: a 4D numpy array consists of RGB values within [0, 255]. # Returns Preprocessed array. """ return imagenet_utils.preprocess_input(x, mode='tf', **kwargs)
[ "def", "preprocess_input", "(", "x", ",", "*", "*", "kwargs", ")", ":", "return", "imagenet_utils", ".", "preprocess_input", "(", "x", ",", "mode", "=", "'tf'", ",", "*", "*", "kwargs", ")" ]
https://github.com/keras-team/keras-applications/blob/bc89834ed36935ab4a4994446e34ff81c0d8e1b7/keras_applications/mobilenet.py#L75-L84
sfu-db/dataprep
6dfb9c659e8bf73f07978ae195d0372495c6f118
dataprep/clean/clean_duplication_utils.py
python
Clusterer.set_cluster_params
(self, ngram: int, radius: int, block_size: int)
Set clustering parameters.
Set clustering parameters.
[ "Set", "clustering", "parameters", "." ]
def set_cluster_params(self, ngram: int, radius: int, block_size: int) -> None: """ Set clustering parameters. """ self._ngram = ngram self._radius = radius self._block_size = block_size
[ "def", "set_cluster_params", "(", "self", ",", "ngram", ":", "int", ",", "radius", ":", "int", ",", "block_size", ":", "int", ")", "->", "None", ":", "self", ".", "_ngram", "=", "ngram", "self", ".", "_radius", "=", "radius", "self", ".", "_block_size"...
https://github.com/sfu-db/dataprep/blob/6dfb9c659e8bf73f07978ae195d0372495c6f118/dataprep/clean/clean_duplication_utils.py#L315-L321
tomplus/kubernetes_asyncio
f028cc793e3a2c519be6a52a49fb77ff0b014c9b
kubernetes_asyncio/client/models/extensions_v1beta1_ingress_list.py
python
ExtensionsV1beta1IngressList.api_version
(self, api_version)
Sets the api_version of this ExtensionsV1beta1IngressList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-arch...
Sets the api_version of this ExtensionsV1beta1IngressList.
[ "Sets", "the", "api_version", "of", "this", "ExtensionsV1beta1IngressList", "." ]
def api_version(self, api_version): """Sets the api_version of this ExtensionsV1beta1IngressList. APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://g...
[ "def", "api_version", "(", "self", ",", "api_version", ")", ":", "self", ".", "_api_version", "=", "api_version" ]
https://github.com/tomplus/kubernetes_asyncio/blob/f028cc793e3a2c519be6a52a49fb77ff0b014c9b/kubernetes_asyncio/client/models/extensions_v1beta1_ingress_list.py#L81-L90
digidotcom/xbee-python
0757f4be0017530c205175fbee8f9f61be9614d1
digi/xbee/filesystem.py
python
FileSystemElement.path
(self)
return self._path.decode(encoding='utf8', errors='ignore')
Returns the file system element absolute path. Returns: String: File system element absolute path.
Returns the file system element absolute path.
[ "Returns", "the", "file", "system", "element", "absolute", "path", "." ]
def path(self): """ Returns the file system element absolute path. Returns: String: File system element absolute path. """ return self._path.decode(encoding='utf8', errors='ignore')
[ "def", "path", "(", "self", ")", ":", "return", "self", ".", "_path", ".", "decode", "(", "encoding", "=", "'utf8'", ",", "errors", "=", "'ignore'", ")" ]
https://github.com/digidotcom/xbee-python/blob/0757f4be0017530c205175fbee8f9f61be9614d1/digi/xbee/filesystem.py#L238-L245
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/lib-python/3/asyncore.py
python
dispatcher.handle_error
(self)
[]
def handle_error(self): nil, t, v, tbinfo = compact_traceback() # sometimes a user repr method will crash. try: self_repr = repr(self) except: self_repr = '<__repr__(self) failed for object at %0x>' % id(self) self.log_info( 'uncaptured pytho...
[ "def", "handle_error", "(", "self", ")", ":", "nil", ",", "t", ",", "v", ",", "tbinfo", "=", "compact_traceback", "(", ")", "# sometimes a user repr method will crash.", "try", ":", "self_repr", "=", "repr", "(", "self", ")", "except", ":", "self_repr", "=",...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/lib-python/3/asyncore.py#L483-L501
KalleHallden/AutoTimer
2d954216700c4930baa154e28dbddc34609af7ce
env/lib/python2.7/site-packages/setuptools/package_index.py
python
ContentChecker.is_valid
(self)
return True
Check the hash. Return False if validation fails.
Check the hash. Return False if validation fails.
[ "Check", "the", "hash", ".", "Return", "False", "if", "validation", "fails", "." ]
def is_valid(self): """ Check the hash. Return False if validation fails. """ return True
[ "def", "is_valid", "(", "self", ")", ":", "return", "True" ]
https://github.com/KalleHallden/AutoTimer/blob/2d954216700c4930baa154e28dbddc34609af7ce/env/lib/python2.7/site-packages/setuptools/package_index.py#L251-L255
IronLanguages/main
a949455434b1fda8c783289e897e78a9a0caabb5
External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xml/sax/xmlreader.py
python
InputSource.getSystemId
(self)
return self.__system_id
Returns the system identifier of this InputSource.
Returns the system identifier of this InputSource.
[ "Returns", "the", "system", "identifier", "of", "this", "InputSource", "." ]
def getSystemId(self): "Returns the system identifier of this InputSource." return self.__system_id
[ "def", "getSystemId", "(", "self", ")", ":", "return", "self", ".", "__system_id" ]
https://github.com/IronLanguages/main/blob/a949455434b1fda8c783289e897e78a9a0caabb5/External.LCA_RESTRICTED/Languages/IronPython/27/Lib/xml/sax/xmlreader.py#L222-L224
huggingface/transformers
623b4f7c63f60cce917677ee704d6c93ee960b4b
examples/research_projects/rag/callbacks_rag.py
python
Seq2SeqLoggingCallback._write_logs
( self, trainer: pl.Trainer, pl_module: pl.LightningModule, type_path: str, save_generations=True )
[]
def _write_logs( self, trainer: pl.Trainer, pl_module: pl.LightningModule, type_path: str, save_generations=True ) -> None: logger.info(f"***** {type_path} results at step {trainer.global_step:05d} *****") metrics = trainer.callback_metrics trainer.logger.log_metrics({k: v for k, v i...
[ "def", "_write_logs", "(", "self", ",", "trainer", ":", "pl", ".", "Trainer", ",", "pl_module", ":", "pl", ".", "LightningModule", ",", "type_path", ":", "str", ",", "save_generations", "=", "True", ")", "->", "None", ":", "logger", ".", "info", "(", "...
https://github.com/huggingface/transformers/blob/623b4f7c63f60cce917677ee704d6c93ee960b4b/examples/research_projects/rag/callbacks_rag.py#L61-L94
fregu856/2D_detection
1f22a6d604d39f8f79fe916fcdbf40b5b668a39a
model.py
python
SqueezeDet_model.tensor_IOU
(self, box1, box2)
return IOU
[]
def tensor_IOU(self, box1, box2): # intersection: xmin = tf.maximum(box1[0], box2[0]) ymin = tf.maximum(box1[1], box2[1]) xmax = tf.minimum(box1[2], box2[2]) ymax = tf.minimum(box1[3], box2[3]) w = tf.maximum(0.0, xmax - xmin) h = tf.maximum(0.0, ymax - ymin) ...
[ "def", "tensor_IOU", "(", "self", ",", "box1", ",", "box2", ")", ":", "# intersection:", "xmin", "=", "tf", ".", "maximum", "(", "box1", "[", "0", "]", ",", "box2", "[", "0", "]", ")", "ymin", "=", "tf", ".", "maximum", "(", "box1", "[", "1", "...
https://github.com/fregu856/2D_detection/blob/1f22a6d604d39f8f79fe916fcdbf40b5b668a39a/model.py#L463-L483
spectacles/CodeComplice
8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62
libs/koXMLTreeService.py
python
TreeService.getTreeForURI
(self, uri, content=None)
return tree
[]
def getTreeForURI(self, uri, content=None): if not uri and not content: return None tree = None if uri and uri in self.__treeMap: tree = self.__treeMap[uri] # if tree is not None: # print "tree cache hit for [%s]"%uri if not content:...
[ "def", "getTreeForURI", "(", "self", ",", "uri", ",", "content", "=", "None", ")", ":", "if", "not", "uri", "and", "not", "content", ":", "return", "None", "tree", "=", "None", "if", "uri", "and", "uri", "in", "self", ".", "__treeMap", ":", "tree", ...
https://github.com/spectacles/CodeComplice/blob/8ca8ee4236f72b58caa4209d2fbd5fa56bd31d62/libs/koXMLTreeService.py#L523-L553
QuantumFractal/Data-Structure-Zoo
3884d55fac0cccf3b17d18550ec52a285f909c2c
0-Object-Oriented Programming/objects.py
python
Truck.vroom
(self)
return 'Vroooooom'
[]
def vroom(self): return 'Vroooooom'
[ "def", "vroom", "(", "self", ")", ":", "return", "'Vroooooom'" ]
https://github.com/QuantumFractal/Data-Structure-Zoo/blob/3884d55fac0cccf3b17d18550ec52a285f909c2c/0-Object-Oriented Programming/objects.py#L45-L46
JetBrains/python-skeletons
95ad24b666e475998e5d1cc02ed53a2188036167
builtins.py
python
str.swapcase
(self)
return ''
Return a copy of the string with uppercase characters converted to lowercase and vice versa. :rtype: str
Return a copy of the string with uppercase characters converted to lowercase and vice versa.
[ "Return", "a", "copy", "of", "the", "string", "with", "uppercase", "characters", "converted", "to", "lowercase", "and", "vice", "versa", "." ]
def swapcase(self): """Return a copy of the string with uppercase characters converted to lowercase and vice versa. :rtype: str """ return ''
[ "def", "swapcase", "(", "self", ")", ":", "return", "''" ]
https://github.com/JetBrains/python-skeletons/blob/95ad24b666e475998e5d1cc02ed53a2188036167/builtins.py#L1701-L1707
yantisj/netgrph
0ebc72efbd970e0ce76d44d91a27d167103633b5
nglib/query/__init__.py
python
display_mgmt_groups
()
Print all Management Groups to the Screen
Print all Management Groups to the Screen
[ "Print", "all", "Management", "Groups", "to", "the", "Screen" ]
def display_mgmt_groups(): """Print all Management Groups to the Screen""" mgmt = nglib.py2neo_ses.cypher.execute( 'MATCH (s:Switch) RETURN DISTINCT(s.mgmt) as name ORDER BY name') if len(mgmt) > 0: print("Available Groups:") for s in mgmt.records: print("> " + str(s.na...
[ "def", "display_mgmt_groups", "(", ")", ":", "mgmt", "=", "nglib", ".", "py2neo_ses", ".", "cypher", ".", "execute", "(", "'MATCH (s:Switch) RETURN DISTINCT(s.mgmt) as name ORDER BY name'", ")", "if", "len", "(", "mgmt", ")", ">", "0", ":", "print", "(", "\"Avai...
https://github.com/yantisj/netgrph/blob/0ebc72efbd970e0ce76d44d91a27d167103633b5/nglib/query/__init__.py#L68-L79
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/elasticsearch/client/indices.py
python
IndicesClient.clear_cache
(self, index=None, params=None)
return data
Clear either all caches or specific cached associated with one ore more indices. `<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-clearcache.html>`_ :arg index: A comma-separated list of index name to limit the operation :arg field_data: Clear field data :...
Clear either all caches or specific cached associated with one ore more indices. `<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-clearcache.html>`_
[ "Clear", "either", "all", "caches", "or", "specific", "cached", "associated", "with", "one", "ore", "more", "indices", ".", "<http", ":", "//", "www", ".", "elasticsearch", ".", "org", "/", "guide", "/", "en", "/", "elasticsearch", "/", "reference", "/", ...
def clear_cache(self, index=None, params=None): """ Clear either all caches or specific cached associated with one ore more indices. `<http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/indices-clearcache.html>`_ :arg index: A comma-separated list of index name to lim...
[ "def", "clear_cache", "(", "self", ",", "index", "=", "None", ",", "params", "=", "None", ")", ":", "_", ",", "data", "=", "self", ".", "transport", ".", "perform_request", "(", "'POST'", ",", "_make_path", "(", "index", ",", "'_cache'", ",", "'clear'"...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/elasticsearch/client/indices.py#L772-L802
selfteaching/selfteaching-python-camp
9982ee964b984595e7d664b07c389cddaf158f1e
exercises/1901100108/d07/mymodule/stats_word.py
python
stats_text
(text)
return stats_text_en(text) + stats_text_cn(text)
合并 英文词频 和 中文字频 的结果
合并 英文词频 和 中文字频 的结果
[ "合并", "英文词频", "和", "中文字频", "的结果" ]
def stats_text(text): ''' 合并 英文词频 和 中文字频 的结果 ''' return stats_text_en(text) + stats_text_cn(text)
[ "def", "stats_text", "(", "text", ")", ":", "return", "stats_text_en", "(", "text", ")", "+", "stats_text_cn", "(", "text", ")" ]
https://github.com/selfteaching/selfteaching-python-camp/blob/9982ee964b984595e7d664b07c389cddaf158f1e/exercises/1901100108/d07/mymodule/stats_word.py#L36-L40
ales-tsurko/cells
4cf7e395cd433762bea70cdc863a346f3a6fe1d0
packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/lockfile/sqlitelockfile.py
python
SQLiteLockFile.__init__
(self, path, threaded=True, timeout=None)
>>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False)
>>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False)
[ ">>>", "lock", "=", "SQLiteLockFile", "(", "somefile", ")", ">>>", "lock", "=", "SQLiteLockFile", "(", "somefile", "threaded", "=", "False", ")" ]
def __init__(self, path, threaded=True, timeout=None): """ >>> lock = SQLiteLockFile('somefile') >>> lock = SQLiteLockFile('somefile', threaded=False) """ LockBase.__init__(self, path, threaded, timeout) self.lock_file = unicode(self.lock_file) self.unique_name = ...
[ "def", "__init__", "(", "self", ",", "path", ",", "threaded", "=", "True", ",", "timeout", "=", "None", ")", ":", "LockBase", ".", "__init__", "(", "self", ",", "path", ",", "threaded", ",", "timeout", ")", "self", ".", "lock_file", "=", "unicode", "...
https://github.com/ales-tsurko/cells/blob/4cf7e395cd433762bea70cdc863a346f3a6fe1d0/packaging/macos/python/lib/python3.7/site-packages/pip/_vendor/lockfile/sqlitelockfile.py#L19-L51
pypa/pip
7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4
src/pip/_vendor/rich/ansi.py
python
_ansi_tokenize
(ansi_text: str)
Tokenize a string in to plain text and ANSI codes. Args: ansi_text (str): A String containing ANSI codes. Yields: AnsiToken: A named tuple of (plain, sgr, osc)
Tokenize a string in to plain text and ANSI codes.
[ "Tokenize", "a", "string", "in", "to", "plain", "text", "and", "ANSI", "codes", "." ]
def _ansi_tokenize(ansi_text: str) -> Iterable[_AnsiToken]: """Tokenize a string in to plain text and ANSI codes. Args: ansi_text (str): A String containing ANSI codes. Yields: AnsiToken: A named tuple of (plain, sgr, osc) """ def remove_csi(ansi_text: str) -> str: """Remo...
[ "def", "_ansi_tokenize", "(", "ansi_text", ":", "str", ")", "->", "Iterable", "[", "_AnsiToken", "]", ":", "def", "remove_csi", "(", "ansi_text", ":", "str", ")", "->", "str", ":", "\"\"\"Remove unknown CSI sequences.\"\"\"", "return", "re_csi", ".", "sub", "(...
https://github.com/pypa/pip/blob/7f8a6844037fb7255cfd0d34ff8e8cf44f2598d4/src/pip/_vendor/rich/ansi.py#L21-L44
apache/superset
3d829fc3c838358dd8c798ecaeefd34c502edca0
superset/connectors/sqla/views.py
python
TableModelView.edit
(self, pk: str)
return redirect("/superset/explore/table/{}/".format(pk))
Simple hack to redirect to explore view after saving
Simple hack to redirect to explore view after saving
[ "Simple", "hack", "to", "redirect", "to", "explore", "view", "after", "saving" ]
def edit(self, pk: str) -> FlaskResponse: """Simple hack to redirect to explore view after saving""" resp = super().edit(pk) if isinstance(resp, str): return resp return redirect("/superset/explore/table/{}/".format(pk))
[ "def", "edit", "(", "self", ",", "pk", ":", "str", ")", "->", "FlaskResponse", ":", "resp", "=", "super", "(", ")", ".", "edit", "(", "pk", ")", "if", "isinstance", "(", "resp", ",", "str", ")", ":", "return", "resp", "return", "redirect", "(", "...
https://github.com/apache/superset/blob/3d829fc3c838358dd8c798ecaeefd34c502edca0/superset/connectors/sqla/views.py#L557-L562
securesystemslab/zippy
ff0e84ac99442c2c55fe1d285332cfd4e185e089
zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/query/spans.py
python
Span.__init__
(self, start, end=None, startchar=None, endchar=None, boost=1.0)
[]
def __init__(self, start, end=None, startchar=None, endchar=None, boost=1.0): if end is None: end = start assert start <= end self.start = start self.end = end self.startchar = startchar self.endchar = endchar self.boost = boost
[ "def", "__init__", "(", "self", ",", "start", ",", "end", "=", "None", ",", "startchar", "=", "None", ",", "endchar", "=", "None", ",", "boost", "=", "1.0", ")", ":", "if", "end", "is", "None", ":", "end", "=", "start", "assert", "start", "<=", "...
https://github.com/securesystemslab/zippy/blob/ff0e84ac99442c2c55fe1d285332cfd4e185e089/zippy/benchmarks/src/benchmarks/whoosh/src/whoosh/query/spans.py#L56-L65
catalyst-team/catalyst
678dc06eda1848242df010b7f34adb572def2598
catalyst/contrib/losses/regression.py
python
_ce_with_logits
(logits, target)
return torch.sum(-target * torch.log_softmax(logits, -1), -1)
Returns cross entropy for giving logits
Returns cross entropy for giving logits
[ "Returns", "cross", "entropy", "for", "giving", "logits" ]
def _ce_with_logits(logits, target): """Returns cross entropy for giving logits""" return torch.sum(-target * torch.log_softmax(logits, -1), -1)
[ "def", "_ce_with_logits", "(", "logits", ",", "target", ")", ":", "return", "torch", ".", "sum", "(", "-", "target", "*", "torch", ".", "log_softmax", "(", "logits", ",", "-", "1", ")", ",", "-", "1", ")" ]
https://github.com/catalyst-team/catalyst/blob/678dc06eda1848242df010b7f34adb572def2598/catalyst/contrib/losses/regression.py#L6-L8
podgorniy/alfred-translate
752a7374b7b3a4ed1f01cbad096f36202e1df77f
src/translate.py
python
get_translation_suggestions
(input_string, spelling_suggestions, vocabulary_article)
return res
Returns XML with translate suggestions
Returns XML with translate suggestions
[ "Returns", "XML", "with", "translate", "suggestions" ]
def get_translation_suggestions(input_string, spelling_suggestions, vocabulary_article): """Returns XML with translate suggestions""" res = [] if len(spelling_suggestions) == 0 and len(vocabulary_article) == 0: return res if len(vocabulary_article['def']) != 0: for article in vocabulary_article['def']: for ...
[ "def", "get_translation_suggestions", "(", "input_string", ",", "spelling_suggestions", ",", "vocabulary_article", ")", ":", "res", "=", "[", "]", "if", "len", "(", "spelling_suggestions", ")", "==", "0", "and", "len", "(", "vocabulary_article", ")", "==", "0", ...
https://github.com/podgorniy/alfred-translate/blob/752a7374b7b3a4ed1f01cbad096f36202e1df77f/src/translate.py#L57-L77
yuzhoujr/leetcode
6a2ad1fc11225db18f68bfadd21a7419d2cb52a4
tree/EricD/111. Minimum Depth of Binary Tree - EricD.py
python
minDepth
(self, root)
:type root: TreeNode :rtype: int
:type root: TreeNode :rtype: int
[ ":", "type", "root", ":", "TreeNode", ":", "rtype", ":", "int" ]
def minDepth(self, root): """ :type root: TreeNode :rtype: int """ if root: if root.left is None and root.right is None: return 1 else: l = self.minDepth(root.left) if root.left else sys.maxint r = self.minDepth(root.right) if root.right else sys.m...
[ "def", "minDepth", "(", "self", ",", "root", ")", ":", "if", "root", ":", "if", "root", ".", "left", "is", "None", "and", "root", ".", "right", "is", "None", ":", "return", "1", "else", ":", "l", "=", "self", ".", "minDepth", "(", "root", ".", ...
https://github.com/yuzhoujr/leetcode/blob/6a2ad1fc11225db18f68bfadd21a7419d2cb52a4/tree/EricD/111. Minimum Depth of Binary Tree - EricD.py#L2-L16
Komodo/KomodoEdit
61edab75dce2bdb03943b387b0608ea36f548e8e
src/components/sciutils.py
python
genLinesBwd
(offset, styledText, position)
r"""Generate styled lines backwards from the given position. "offset" is the position offset from the start of the source SciMoz buffer at which "styledText" begins. I.e. the whole buffer is not necessarily passed in. "styledText" is the styled text from which to extract. ...
r"""Generate styled lines backwards from the given position. "offset" is the position offset from the start of the source SciMoz buffer at which "styledText" begins. I.e. the whole buffer is not necessarily passed in. "styledText" is the styled text from which to extract. ...
[ "r", "Generate", "styled", "lines", "backwards", "from", "the", "given", "position", ".", "offset", "is", "the", "position", "offset", "from", "the", "start", "of", "the", "source", "SciMoz", "buffer", "at", "which", "styledText", "begins", ".", "I", ".", ...
def genLinesBwd(offset, styledText, position): r"""Generate styled lines backwards from the given position. "offset" is the position offset from the start of the source SciMoz buffer at which "styledText" begins. I.e. the whole buffer is not necessarily passed in. "style...
[ "def", "genLinesBwd", "(", "offset", ",", "styledText", ",", "position", ")", ":", "DEBUG", "=", "0", "if", "DEBUG", ":", "print", "_printBanner", "(", "\"genLinesBwd(offset=%d, styledText, position=%d)\"", "%", "(", "offset", ",", "position", ")", ")", "_printB...
https://github.com/Komodo/KomodoEdit/blob/61edab75dce2bdb03943b387b0608ea36f548e8e/src/components/sciutils.py#L330-L381
geekan/scrapy-examples
edb1cb116bd6def65a6ef01f953b58eb43e54305
alexa_topsites/alexa_topsites/spiders/spider.py
python
alexa_topsitesSpider.parse_1
(self, response)
[]
def parse_1(self, response): info('Parse '+response.url) x = self.parse_with_rules(response, self.list_css_rules, dict) # x = self.parse_with_rules(response, self.content_css_rules, dict) print(json.dumps(x, ensure_ascii=False, indent=2))
[ "def", "parse_1", "(", "self", ",", "response", ")", ":", "info", "(", "'Parse '", "+", "response", ".", "url", ")", "x", "=", "self", ".", "parse_with_rules", "(", "response", ",", "self", ".", "list_css_rules", ",", "dict", ")", "# x = self.parse_with_ru...
https://github.com/geekan/scrapy-examples/blob/edb1cb116bd6def65a6ef01f953b58eb43e54305/alexa_topsites/alexa_topsites/spiders/spider.py#L47-L51
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_hxb2/lib/python3.5/site-packages/pip/commands/__init__.py
python
_sort_commands
(cmddict, order)
return sorted(cmddict.items(), key=keyfn)
[]
def _sort_commands(cmddict, order): def keyfn(key): try: return order.index(key[1]) except ValueError: # unordered items should come last return 0xff return sorted(cmddict.items(), key=keyfn)
[ "def", "_sort_commands", "(", "cmddict", ",", "order", ")", ":", "def", "keyfn", "(", "key", ")", ":", "try", ":", "return", "order", ".", "index", "(", "key", "[", "1", "]", ")", "except", "ValueError", ":", "# unordered items should come last", "return",...
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_hxb2/lib/python3.5/site-packages/pip/commands/__init__.py#L78-L86
hudson-and-thames/mlfinlab
79dcc7120ec84110578f75b025a75850eb72fc73
mlfinlab/codependence/information.py
python
get_optimal_number_of_bins
(num_obs: int, corr_coef: float = None)
Calculates optimal number of bins for discretization based on number of observations and correlation coefficient (univariate case). Algorithms used in this function were originally proposed in the works of Hacine-Gharbi et al. (2012) and Hacine-Gharbi and Ravier (2018). They are described in the Cornell le...
Calculates optimal number of bins for discretization based on number of observations and correlation coefficient (univariate case).
[ "Calculates", "optimal", "number", "of", "bins", "for", "discretization", "based", "on", "number", "of", "observations", "and", "correlation", "coefficient", "(", "univariate", "case", ")", "." ]
def get_optimal_number_of_bins(num_obs: int, corr_coef: float = None) -> int: """ Calculates optimal number of bins for discretization based on number of observations and correlation coefficient (univariate case). Algorithms used in this function were originally proposed in the works of Hacine-Gharbi e...
[ "def", "get_optimal_number_of_bins", "(", "num_obs", ":", "int", ",", "corr_coef", ":", "float", "=", "None", ")", "->", "int", ":", "pass" ]
https://github.com/hudson-and-thames/mlfinlab/blob/79dcc7120ec84110578f75b025a75850eb72fc73/mlfinlab/codependence/information.py#L12-L26
i3visio/osrframework
e02a6e9b1346ab5a01244c0d19bcec8232bf1a37
osrframework/domainfy.py
python
create_domains
(tlds, nicks=None, nicks_file=None)
return domain_candidates
Method that globally permits to generate the domains to be checked Args: tlds (list): List of tlds. nicks (list): List of aliases. nicks_file (str): The filepath to the aliases file. Returns: list: The list of domains to be checked.
Method that globally permits to generate the domains to be checked
[ "Method", "that", "globally", "permits", "to", "generate", "the", "domains", "to", "be", "checked" ]
def create_domains(tlds, nicks=None, nicks_file=None): """Method that globally permits to generate the domains to be checked Args: tlds (list): List of tlds. nicks (list): List of aliases. nicks_file (str): The filepath to the aliases file. Returns: list: The list of domain...
[ "def", "create_domains", "(", "tlds", ",", "nicks", "=", "None", ",", "nicks_file", "=", "None", ")", ":", "domain_candidates", "=", "[", "]", "if", "nicks", "is", "not", "None", ":", "for", "nick", "in", "nicks", ":", "for", "tld", "in", "tlds", ":"...
https://github.com/i3visio/osrframework/blob/e02a6e9b1346ab5a01244c0d19bcec8232bf1a37/osrframework/domainfy.py#L207-L239
eliben/pyelftools
8f7a0becaface09435c4374947548b7851e3d1a2
elftools/dwarf/callframe.py
python
CFIEntry._decode_CFI_table
(self)
return DecodedCallFrameTable(table=table, reg_order=reg_order)
Decode the instructions contained in the given CFI entry and return a DecodedCallFrameTable.
Decode the instructions contained in the given CFI entry and return a DecodedCallFrameTable.
[ "Decode", "the", "instructions", "contained", "in", "the", "given", "CFI", "entry", "and", "return", "a", "DecodedCallFrameTable", "." ]
def _decode_CFI_table(self): """ Decode the instructions contained in the given CFI entry and return a DecodedCallFrameTable. """ if isinstance(self, CIE): # For a CIE, initialize cur_line to an "empty" line cie = self cur_line = dict(pc=0, cfa=CFA...
[ "def", "_decode_CFI_table", "(", "self", ")", ":", "if", "isinstance", "(", "self", ",", "CIE", ")", ":", "# For a CIE, initialize cur_line to an \"empty\" line", "cie", "=", "self", "cur_line", "=", "dict", "(", "pc", "=", "0", ",", "cfa", "=", "CFARule", "...
https://github.com/eliben/pyelftools/blob/8f7a0becaface09435c4374947548b7851e3d1a2/elftools/dwarf/callframe.py#L505-L625
hyperledger/aries-cloudagent-python
2f36776e99f6053ae92eed8123b5b1b2e891c02a
aries_cloudagent/messaging/models/base.py
python
BaseModel.validate
(self, unknown: str = None)
return self
Validate a constructed model.
Validate a constructed model.
[ "Validate", "a", "constructed", "model", "." ]
def validate(self, unknown: str = None): """Validate a constructed model.""" schema = self.Schema(unknown=unknown) errors = schema.validate(self.serialize()) if errors: raise ValidationError(errors) return self
[ "def", "validate", "(", "self", ",", "unknown", ":", "str", "=", "None", ")", ":", "schema", "=", "self", ".", "Schema", "(", "unknown", "=", "unknown", ")", "errors", "=", "schema", ".", "validate", "(", "self", ".", "serialize", "(", ")", ")", "i...
https://github.com/hyperledger/aries-cloudagent-python/blob/2f36776e99f6053ae92eed8123b5b1b2e891c02a/aries_cloudagent/messaging/models/base.py#L182-L188
skyfielders/python-skyfield
0e68757a5c1081f784c58fd7a76635c6deb98451
skyfield/toposlib.py
python
GeographicPosition.lst_hours_at
(self, t)
return (t.gast + self.longitude._hours + sprime / 54000.0) % 24.0
Return the Local Apparent Sidereal Time, in hours, at time ``t``. This location’s Local Apparent Sidereal Time (LAST) is the right ascension of the zenith at the time ``t``, as measured against the “true” Earth equator and equinox (rather than the fictional “mean” equator and equinox, w...
Return the Local Apparent Sidereal Time, in hours, at time ``t``.
[ "Return", "the", "Local", "Apparent", "Sidereal", "Time", "in", "hours", "at", "time", "t", "." ]
def lst_hours_at(self, t): """Return the Local Apparent Sidereal Time, in hours, at time ``t``. This location’s Local Apparent Sidereal Time (LAST) is the right ascension of the zenith at the time ``t``, as measured against the “true” Earth equator and equinox (rather than the fictional...
[ "def", "lst_hours_at", "(", "self", ",", "t", ")", ":", "sprime", "=", "-", "47.0e-6", "*", "(", "t", ".", "whole", "-", "T0", "+", "t", ".", "tdb_fraction", ")", "/", "36525.0", "return", "(", "t", ".", "gast", "+", "self", ".", "longitude", "."...
https://github.com/skyfielders/python-skyfield/blob/0e68757a5c1081f784c58fd7a76635c6deb98451/skyfield/toposlib.py#L87-L97
maas/maas
db2f89970c640758a51247c59bf1ec6f60cf4ab5
src/maasserver/models/filesystem.py
python
Filesystem.get_physical_block_devices
(self)
return devices
Return PhysicalBlockDevices backing the filesystem.
Return PhysicalBlockDevices backing the filesystem.
[ "Return", "PhysicalBlockDevices", "backing", "the", "filesystem", "." ]
def get_physical_block_devices(self): """Return PhysicalBlockDevices backing the filesystem.""" from maasserver.models.virtualblockdevice import VirtualBlockDevice devices = [] parent = self.get_parent() if isinstance(parent, PhysicalBlockDevice): devices.append(pare...
[ "def", "get_physical_block_devices", "(", "self", ")", ":", "from", "maasserver", ".", "models", ".", "virtualblockdevice", "import", "VirtualBlockDevice", "devices", "=", "[", "]", "parent", "=", "self", ".", "get_parent", "(", ")", "if", "isinstance", "(", "...
https://github.com/maas/maas/blob/db2f89970c640758a51247c59bf1ec6f60cf4ab5/src/maasserver/models/filesystem.py#L172-L187
materialsproject/pymatgen
8128f3062a334a2edd240e4062b5b9bdd1ae6f58
pymatgen/analysis/phase_diagram.py
python
PhaseDiagram.get_all_chempots
(self, comp)
return chempots
Get chemical potentials at a given compositon. Args: comp (Composition): Composition Returns: Chemical potentials.
Get chemical potentials at a given compositon.
[ "Get", "chemical", "potentials", "at", "a", "given", "compositon", "." ]
def get_all_chempots(self, comp): """ Get chemical potentials at a given compositon. Args: comp (Composition): Composition Returns: Chemical potentials. """ all_facets = self._get_all_facets_and_simplexes(comp) chempots = {} for ...
[ "def", "get_all_chempots", "(", "self", ",", "comp", ")", ":", "all_facets", "=", "self", ".", "_get_all_facets_and_simplexes", "(", "comp", ")", "chempots", "=", "{", "}", "for", "facet", "in", "all_facets", ":", "facet_name", "=", "\"-\"", ".", "join", "...
https://github.com/materialsproject/pymatgen/blob/8128f3062a334a2edd240e4062b5b9bdd1ae6f58/pymatgen/analysis/phase_diagram.py#L897-L914
asciidisco/plugin.video.netflix
ceb2638a9676f5839250dadfd079b9e4e4bdd759
resources/lib/NetflixSession.py
python
NetflixSession.parse_video_list_ids_entry
(self, id, entry)
return { id: { 'id': id, 'index': entry['index'], 'name': entry['context'], 'displayName': entry['displayName'], 'size': entry['length'] } }
Parse a video id entry e.g. rip out the parts we need Parameters ---------- response_data : :obj:`dict` of :obj:`str` Dictionary entry from the ´fetch_video_list_ids´ call Returns ------- id : :obj:`str` Unique id of the video list entry...
Parse a video id entry e.g. rip out the parts we need
[ "Parse", "a", "video", "id", "entry", "e", ".", "g", ".", "rip", "out", "the", "parts", "we", "need" ]
def parse_video_list_ids_entry(self, id, entry): """Parse a video id entry e.g. rip out the parts we need Parameters ---------- response_data : :obj:`dict` of :obj:`str` Dictionary entry from the ´fetch_video_list_ids´ call Returns ------- id : :obj:...
[ "def", "parse_video_list_ids_entry", "(", "self", ",", "id", ",", "entry", ")", ":", "return", "{", "id", ":", "{", "'id'", ":", "id", ",", "'index'", ":", "entry", "[", "'index'", "]", ",", "'name'", ":", "entry", "[", "'context'", "]", ",", "'displ...
https://github.com/asciidisco/plugin.video.netflix/blob/ceb2638a9676f5839250dadfd079b9e4e4bdd759/resources/lib/NetflixSession.py#L580-L612
zhl2008/awd-platform
0416b31abea29743387b10b3914581fbe8e7da5e
web_flaskbb/Python-2.7.9/Lib/lib-tk/Tix.py
python
Tk.destroy
(self)
[]
def destroy(self): # For safety, remove an delete_window binding before destroy self.protocol("WM_DELETE_WINDOW", "") Tkinter.Tk.destroy(self)
[ "def", "destroy", "(", "self", ")", ":", "# For safety, remove an delete_window binding before destroy", "self", ".", "protocol", "(", "\"WM_DELETE_WINDOW\"", ",", "\"\"", ")", "Tkinter", ".", "Tk", ".", "destroy", "(", "self", ")" ]
https://github.com/zhl2008/awd-platform/blob/0416b31abea29743387b10b3914581fbe8e7da5e/web_flaskbb/Python-2.7.9/Lib/lib-tk/Tix.py#L223-L226
kuri65536/python-for-android
26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891
python-build/python-libs/gdata/src/gdata/spreadsheet/service.py
python
SpreadsheetsService.GetListFeed
(self, key, wksht_id='default', row_id=None, query=None, visibility='private', projection='full')
Gets a list feed or a specific entry if a row_id is defined Args: key: string The spreadsheet key defined in /ccc?key= wksht_id: string The id for a specific worksheet entry row_id: string (optional) The row_id of a row in the list query: DocumentQuery (optional) Query parameters ...
Gets a list feed or a specific entry if a row_id is defined Args: key: string The spreadsheet key defined in /ccc?key= wksht_id: string The id for a specific worksheet entry row_id: string (optional) The row_id of a row in the list query: DocumentQuery (optional) Query parameters ...
[ "Gets", "a", "list", "feed", "or", "a", "specific", "entry", "if", "a", "row_id", "is", "defined", "Args", ":", "key", ":", "string", "The", "spreadsheet", "key", "defined", "in", "/", "ccc?key", "=", "wksht_id", ":", "string", "The", "id", "for", "a",...
def GetListFeed(self, key, wksht_id='default', row_id=None, query=None, visibility='private', projection='full'): """Gets a list feed or a specific entry if a row_id is defined Args: key: string The spreadsheet key defined in /ccc?key= wksht_id: string The id for a specific worksheet entry ...
[ "def", "GetListFeed", "(", "self", ",", "key", ",", "wksht_id", "=", "'default'", ",", "row_id", "=", "None", ",", "query", "=", "None", ",", "visibility", "=", "'private'", ",", "projection", "=", "'full'", ")", ":", "uri", "=", "(", "'http://%s/feeds/l...
https://github.com/kuri65536/python-for-android/blob/26402a08fc46b09ef94e8d7a6bbc3a54ff9d0891/python-build/python-libs/gdata/src/gdata/spreadsheet/service.py#L220-L249
brightmart/xlnet_zh
75e39630ec0856509cde45aa0505195e32564466
src/run_classifier.py
python
ImdbProcessor.get_dev_examples
(self, data_dir)
return self._create_examples(os.path.join(data_dir, "test"))
[]
def get_dev_examples(self, data_dir): return self._create_examples(os.path.join(data_dir, "test"))
[ "def", "get_dev_examples", "(", "self", ",", "data_dir", ")", ":", "return", "self", ".", "_create_examples", "(", "os", ".", "path", ".", "join", "(", "data_dir", ",", "\"test\"", ")", ")" ]
https://github.com/brightmart/xlnet_zh/blob/75e39630ec0856509cde45aa0505195e32564466/src/run_classifier.py#L307-L308
elfi-dev/elfi
07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c
elfi/methods/inference/romc.py
python
ROMC._filter_solutions
(self, eps_filter)
Filter out the solutions over eps threshold. Parameters ---------- eps_filter: float the threshold for filtering out solutions
Filter out the solutions over eps threshold.
[ "Filter", "out", "the", "solutions", "over", "eps", "threshold", "." ]
def _filter_solutions(self, eps_filter): """Filter out the solutions over eps threshold. Parameters ---------- eps_filter: float the threshold for filtering out solutions """ # checks assert self.inference_state["_has_solved_problems"] # get...
[ "def", "_filter_solutions", "(", "self", ",", "eps_filter", ")", ":", "# checks", "assert", "self", ".", "inference_state", "[", "\"_has_solved_problems\"", "]", "# getters", "n1", "=", "self", ".", "inference_args", "[", "\"N1\"", "]", "solved", "=", "self", ...
https://github.com/elfi-dev/elfi/blob/07ac0ed5e81d5d5fb42de63db3cf9ccc9135b88c/elfi/methods/inference/romc.py#L726-L753
google-research/tensorflow_constrained_optimization
723d63f8567aaa988c4ce4761152beee2b462e1d
tensorflow_constrained_optimization/python/rates/loss.py
python
HingeLoss.__init__
(self, margin=1.0)
Creates a new HingeLoss object with the given margin. The margin determines how far a prediction must be from the decision boundary in order for it to be penalized. When the margin is zero, this threshold is exactly the decision boundary. When the margin is at least one, the hinge loss upper bounds the...
Creates a new HingeLoss object with the given margin.
[ "Creates", "a", "new", "HingeLoss", "object", "with", "the", "given", "margin", "." ]
def __init__(self, margin=1.0): """Creates a new HingeLoss object with the given margin. The margin determines how far a prediction must be from the decision boundary in order for it to be penalized. When the margin is zero, this threshold is exactly the decision boundary. When the margin is at least o...
[ "def", "__init__", "(", "self", ",", "margin", "=", "1.0", ")", ":", "super", "(", "HingeLoss", ",", "self", ")", ".", "__init__", "(", ")", "self", ".", "_margin", "=", "float", "(", "margin", ")", "if", "margin", "<", "0.0", ":", "raise", "ValueE...
https://github.com/google-research/tensorflow_constrained_optimization/blob/723d63f8567aaa988c4ce4761152beee2b462e1d/tensorflow_constrained_optimization/python/rates/loss.py#L358-L376
Epistimio/orion
732e739d99561020dbe620760acf062ade746006
src/orion/algo/asha.py
python
ASHABracket.is_filled
(self)
return False
ASHA's first rung can always sample new trials
ASHA's first rung can always sample new trials
[ "ASHA", "s", "first", "rung", "can", "always", "sample", "new", "trials" ]
def is_filled(self): """ASHA's first rung can always sample new trials""" return False
[ "def", "is_filled", "(", "self", ")", ":", "return", "False" ]
https://github.com/Epistimio/orion/blob/732e739d99561020dbe620760acf062ade746006/src/orion/algo/asha.py#L256-L258
minerllabs/minerl
0123527c334c96ebb3f0cf313df1552fa4302691
minerl/herobraine/hero/handlers/agent/observations/location_stats.py
python
_ZPositionObservation.__init__
(self)
[]
def __init__(self): super().__init__(key_list=['zpos'], space=spaces.Box(low=-640000.0, high=640000.0, shape=(), dtype=np.float), default_if_missing=0.0)
[ "def", "__init__", "(", "self", ")", ":", "super", "(", ")", ".", "__init__", "(", "key_list", "=", "[", "'zpos'", "]", ",", "space", "=", "spaces", ".", "Box", "(", "low", "=", "-", "640000.0", ",", "high", "=", "640000.0", ",", "shape", "=", "(...
https://github.com/minerllabs/minerl/blob/0123527c334c96ebb3f0cf313df1552fa4302691/minerl/herobraine/hero/handlers/agent/observations/location_stats.py#L98-L100
sagemath/sage
f9b2db94f675ff16963ccdefba4f1a3393b3fe0d
src/sage/combinat/finite_state_machine.py
python
FiniteStateMachine.prepone_output
(self)
For all paths, shift the output of the path from one transition to the earliest possible preceding transition of the path. INPUT: Nothing. OUTPUT: Nothing. Apply the following to each state `s` (except initial states) of the finite state machine as of...
For all paths, shift the output of the path from one transition to the earliest possible preceding transition of the path.
[ "For", "all", "paths", "shift", "the", "output", "of", "the", "path", "from", "one", "transition", "to", "the", "earliest", "possible", "preceding", "transition", "of", "the", "path", "." ]
def prepone_output(self): """ For all paths, shift the output of the path from one transition to the earliest possible preceding transition of the path. INPUT: Nothing. OUTPUT: Nothing. Apply the following to each state `s` (except initial sta...
[ "def", "prepone_output", "(", "self", ")", ":", "def", "find_common_output", "(", "state", ")", ":", "if", "(", "any", "(", "transition", "for", "transition", "in", "self", ".", "transitions", "(", "state", ")", "if", "not", "transition", ".", "word_out", ...
https://github.com/sagemath/sage/blob/f9b2db94f675ff16963ccdefba4f1a3393b3fe0d/src/sage/combinat/finite_state_machine.py#L8845-L9011
lazylibrarian/LazyLibrarian
ae3c14e9db9328ce81765e094ab2a14ed7155624
lib/pythontwitter/__init__.py
python
User.GetStatus
(self)
return self._status
Get the latest twitter.Status of this user. Returns: The latest twitter.Status of this user
Get the latest twitter.Status of this user.
[ "Get", "the", "latest", "twitter", ".", "Status", "of", "this", "user", "." ]
def GetStatus(self): '''Get the latest twitter.Status of this user. Returns: The latest twitter.Status of this user ''' return self._status
[ "def", "GetStatus", "(", "self", ")", ":", "return", "self", ".", "_status" ]
https://github.com/lazylibrarian/LazyLibrarian/blob/ae3c14e9db9328ce81765e094ab2a14ed7155624/lib/pythontwitter/__init__.py#L1127-L1133
ustayready/CredKing
68b612e4cdf01d2b65b14ab2869bb8a5531056ee
plugins/gmail/lxml/html/diff.py
python
cleanup_html
(html)
return html
This 'cleans' the HTML, meaning that any page structure is removed (only the contents of <body> are used, if there is any <body). Also <ins> and <del> tags are removed.
This 'cleans' the HTML, meaning that any page structure is removed (only the contents of <body> are used, if there is any <body). Also <ins> and <del> tags are removed.
[ "This", "cleans", "the", "HTML", "meaning", "that", "any", "page", "structure", "is", "removed", "(", "only", "the", "contents", "of", "<body", ">", "are", "used", "if", "there", "is", "any", "<body", ")", ".", "Also", "<ins", ">", "and", "<del", ">", ...
def cleanup_html(html): """ This 'cleans' the HTML, meaning that any page structure is removed (only the contents of <body> are used, if there is any <body). Also <ins> and <del> tags are removed. """ match = _body_re.search(html) if match: html = html[match.end():] match = _end_body_re...
[ "def", "cleanup_html", "(", "html", ")", ":", "match", "=", "_body_re", ".", "search", "(", "html", ")", "if", "match", ":", "html", "=", "html", "[", "match", ".", "end", "(", ")", ":", "]", "match", "=", "_end_body_re", ".", "search", "(", "html"...
https://github.com/ustayready/CredKing/blob/68b612e4cdf01d2b65b14ab2869bb8a5531056ee/plugins/gmail/lxml/html/diff.py#L557-L568
Ulauncher/Ulauncher
44735d8d4c2b4b8a8d28f95ab6a6c6d577c859e5
ulauncher/utils/desktop/reader.py
python
filter_app
(app, disable_desktop_filters=False)
return app and app.get_string('Name') and app.get_string('Type') == 'Application' \ and (app.get_show_in() or disable_desktop_filters) and not app.get_nodisplay() and not app.get_is_hidden()
:param Gio.DesktopAppInfo app: :returns: True if app can be added to the database
:param Gio.DesktopAppInfo app: :returns: True if app can be added to the database
[ ":", "param", "Gio", ".", "DesktopAppInfo", "app", ":", ":", "returns", ":", "True", "if", "app", "can", "be", "added", "to", "the", "database" ]
def filter_app(app, disable_desktop_filters=False): """ :param Gio.DesktopAppInfo app: :returns: True if app can be added to the database """ return app and app.get_string('Name') and app.get_string('Type') == 'Application' \ and (app.get_show_in() or disable_desktop_filters) and not app.get...
[ "def", "filter_app", "(", "app", ",", "disable_desktop_filters", "=", "False", ")", ":", "return", "app", "and", "app", ".", "get_string", "(", "'Name'", ")", "and", "app", ".", "get_string", "(", "'Type'", ")", "==", "'Application'", "and", "(", "app", ...
https://github.com/Ulauncher/Ulauncher/blob/44735d8d4c2b4b8a8d28f95ab6a6c6d577c859e5/ulauncher/utils/desktop/reader.py#L57-L63
aianaconda/TensorFlow_Engineering_Implementation
cb787e359da9ac5a08d00cd2458fecb4cb5a3a31
tf2code/Chapter8/code8.4/Code8-9/backend.py
python
moving_average_update
(x, value, momentum)
return moving_averages.assign_moving_average( x, value, momentum, zero_debias=zero_debias)
Compute the moving average of a variable. Arguments: x: A Variable. value: A tensor with the same shape as `variable`. momentum: The moving average momentum. Returns: An Operation to update the variable.
Compute the moving average of a variable.
[ "Compute", "the", "moving", "average", "of", "a", "variable", "." ]
def moving_average_update(x, value, momentum): """Compute the moving average of a variable. Arguments: x: A Variable. value: A tensor with the same shape as `variable`. momentum: The moving average momentum. Returns: An Operation to update the variable. """ zero_debias = not tf2.enab...
[ "def", "moving_average_update", "(", "x", ",", "value", ",", "momentum", ")", ":", "zero_debias", "=", "not", "tf2", ".", "enabled", "(", ")", "return", "moving_averages", ".", "assign_moving_average", "(", "x", ",", "value", ",", "momentum", ",", "zero_debi...
https://github.com/aianaconda/TensorFlow_Engineering_Implementation/blob/cb787e359da9ac5a08d00cd2458fecb4cb5a3a31/tf2code/Chapter8/code8.4/Code8-9/backend.py#L1595-L1608
asyml/texar-pytorch
b83d3ec17e19da08fc5f81996d02f91176e55e54
texar/torch/core/attention_mechanism.py
python
monotonic_attention
(p_choose_i: torch.Tensor, previous_attention: torch.Tensor, mode: str)
return attention
r"""Compute monotonic attention distribution from choosing probabilities. Monotonic attention implies that the input sequence is processed in an explicitly left-to-right manner when generating the output sequence. In addition, once an input sequence element is attended to at a given output time step, e...
r"""Compute monotonic attention distribution from choosing probabilities. Monotonic attention implies that the input sequence is processed in an explicitly left-to-right manner when generating the output sequence. In addition, once an input sequence element is attended to at a given output time step, e...
[ "r", "Compute", "monotonic", "attention", "distribution", "from", "choosing", "probabilities", ".", "Monotonic", "attention", "implies", "that", "the", "input", "sequence", "is", "processed", "in", "an", "explicitly", "left", "-", "to", "-", "right", "manner", "...
def monotonic_attention(p_choose_i: torch.Tensor, previous_attention: torch.Tensor, mode: str) -> torch.Tensor: r"""Compute monotonic attention distribution from choosing probabilities. Monotonic attention implies that the input sequence is processed in an exp...
[ "def", "monotonic_attention", "(", "p_choose_i", ":", "torch", ".", "Tensor", ",", "previous_attention", ":", "torch", ".", "Tensor", ",", "mode", ":", "str", ")", "->", "torch", ".", "Tensor", ":", "# Force things to be tensors", "if", "not", "isinstance", "(...
https://github.com/asyml/texar-pytorch/blob/b83d3ec17e19da08fc5f81996d02f91176e55e54/texar/torch/core/attention_mechanism.py#L498-L594
andyzsf/TuShare
92787ad0cd492614bdb6389b71a19c80d1c8c9ae
tushare/datayes/fundamental.py
python
Fundamental.FdmtCFInsu
(self, reportType='', secID='', ticker='', beginDate='', endDate='', publishDateBegin='', publishDateEnd='', field='')
return _ret_data(code, result)
1、根据2007年新会计准则制定的保险业现金流量表模板,收集了2007年以来沪深上市公司定期报告中所有以此模板披露的现金流量表数据;(主要是保险业上市公司) 2、仅收集合并报表数据,包括本期和上期数据; 3、如果上市公司对外财务报表进行更正,调整,均有采集并对外展示; 4、本表中单位为人民币元; 5、每季更新。
1、根据2007年新会计准则制定的保险业现金流量表模板,收集了2007年以来沪深上市公司定期报告中所有以此模板披露的现金流量表数据;(主要是保险业上市公司) 2、仅收集合并报表数据,包括本期和上期数据; 3、如果上市公司对外财务报表进行更正,调整,均有采集并对外展示; 4、本表中单位为人民币元; 5、每季更新。
[ "1、根据2007年新会计准则制定的保险业现金流量表模板,收集了2007年以来沪深上市公司定期报告中所有以此模板披露的现金流量表数据;(主要是保险业上市公司)", "2、仅收集合并报表数据,包括本期和上期数据;", "3、如果上市公司对外财务报表进行更正,调整,均有采集并对外展示;", "4、本表中单位为人民币元;", "5、每季更新。" ]
def FdmtCFInsu(self, reportType='', secID='', ticker='', beginDate='', endDate='', publishDateBegin='', publishDateEnd='', field=''): """ 1、根据2007年新会计准则制定的保险业现金流量表模板,收集了2007年以来沪深上市公司定期报告中所有以此模板披露的现金流量表数据;(主要是保险业上市公司) 2、仅收集合并报表数据,包括本期和上期数据; 3、如果上市公司对外财务报表进行更正,调整,均有采...
[ "def", "FdmtCFInsu", "(", "self", ",", "reportType", "=", "''", ",", "secID", "=", "''", ",", "ticker", "=", "''", ",", "beginDate", "=", "''", ",", "endDate", "=", "''", ",", "publishDateBegin", "=", "''", ",", "publishDateEnd", "=", "''", ",", "fie...
https://github.com/andyzsf/TuShare/blob/92787ad0cd492614bdb6389b71a19c80d1c8c9ae/tushare/datayes/fundamental.py#L157-L169
DataDog/integrations-core
934674b29d94b70ccc008f76ea172d0cdae05e1e
tokumx/datadog_checks/tokumx/vendor/bson/__init__.py
python
_get_binary
(data, position, obj_end, opts, dummy1)
return value, end
Decode a BSON binary to bson.binary.Binary or python UUID.
Decode a BSON binary to bson.binary.Binary or python UUID.
[ "Decode", "a", "BSON", "binary", "to", "bson", ".", "binary", ".", "Binary", "or", "python", "UUID", "." ]
def _get_binary(data, position, obj_end, opts, dummy1): """Decode a BSON binary to bson.binary.Binary or python UUID.""" length, subtype = _UNPACK_LENGTH_SUBTYPE(data[position:position + 5]) position += 5 if subtype == 2: length2 = _UNPACK_INT(data[position:position + 4])[0] position += ...
[ "def", "_get_binary", "(", "data", ",", "position", ",", "obj_end", ",", "opts", ",", "dummy1", ")", ":", "length", ",", "subtype", "=", "_UNPACK_LENGTH_SUBTYPE", "(", "data", "[", "position", ":", "position", "+", "5", "]", ")", "position", "+=", "5", ...
https://github.com/DataDog/integrations-core/blob/934674b29d94b70ccc008f76ea172d0cdae05e1e/tokumx/datadog_checks/tokumx/vendor/bson/__init__.py#L190-L221
mrlesmithjr/Ansible
d44f0dc0d942bdf3bf7334b307e6048f0ee16e36
roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py
python
TreeBuilder.getDocument
(self)
return self.document
Return the final tree
Return the final tree
[ "Return", "the", "final", "tree" ]
def getDocument(self): "Return the final tree" return self.document
[ "def", "getDocument", "(", "self", ")", ":", "return", "self", ".", "document" ]
https://github.com/mrlesmithjr/Ansible/blob/d44f0dc0d942bdf3bf7334b307e6048f0ee16e36/roles/ansible-vsphere-management/scripts/pdns/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py#L369-L371
wulczer/txpostgres
bd56a3648574bfd0c24543e4d9e4a611458c2da1
txpostgres/retrying.py
python
RetryingCall.start
(self, backoffIterator=None, failureTester=None)
return self._deferred
Start the call and retry it until it succeeds and fails. :param backoffIterator: A zero-argument callable that should return a iterator yielding reconnection delay periods. If :class:`None` then :func:`.simpleBackoffIterator` will be used. :type backoffIterator: call...
Start the call and retry it until it succeeds and fails.
[ "Start", "the", "call", "and", "retry", "it", "until", "it", "succeeds", "and", "fails", "." ]
def start(self, backoffIterator=None, failureTester=None): """ Start the call and retry it until it succeeds and fails. :param backoffIterator: A zero-argument callable that should return a iterator yielding reconnection delay periods. If :class:`None` then :func:`.simpl...
[ "def", "start", "(", "self", ",", "backoffIterator", "=", "None", ",", "failureTester", "=", "None", ")", ":", "self", ".", "resetBackoff", "(", "backoffIterator", ")", "if", "failureTester", "is", "None", ":", "failureTester", "=", "lambda", "_", ":", "No...
https://github.com/wulczer/txpostgres/blob/bd56a3648574bfd0c24543e4d9e4a611458c2da1/txpostgres/retrying.py#L135-L166
bubbliiiing/Semantic-Segmentation
4cc89a22ffc9018d2b44e69e85672c7bdd1ab706
deeplab_Mobile/nets/deeplab.py
python
SepConv_BN
(x, filters, prefix, stride=1, kernel_size=3, rate=1, depth_activation=False, epsilon=1e-3)
return x
[]
def SepConv_BN(x, filters, prefix, stride=1, kernel_size=3, rate=1, depth_activation=False, epsilon=1e-3): if stride == 1: depth_padding = 'same' else: kernel_size_effective = kernel_size + (kernel_size - 1) * (rate - 1) pad_total = kernel_size_effective - 1 pad_beg = pad_total /...
[ "def", "SepConv_BN", "(", "x", ",", "filters", ",", "prefix", ",", "stride", "=", "1", ",", "kernel_size", "=", "3", ",", "rate", "=", "1", ",", "depth_activation", "=", "False", ",", "epsilon", "=", "1e-3", ")", ":", "if", "stride", "==", "1", ":"...
https://github.com/bubbliiiing/Semantic-Segmentation/blob/4cc89a22ffc9018d2b44e69e85672c7bdd1ab706/deeplab_Mobile/nets/deeplab.py#L16-L43
google-research/language
61fa7260ac7d690d11ef72ca863e45a37c0bdc80
language/conpono/evals/classifier_utils.py
python
LCQMCPairClassificationProcessor.get_labels
(self)
return ["0", "1"]
See base class.
See base class.
[ "See", "base", "class", "." ]
def get_labels(self): """See base class.""" return ["0", "1"]
[ "def", "get_labels", "(", "self", ")", ":", "return", "[", "\"0\"", ",", "\"1\"", "]" ]
https://github.com/google-research/language/blob/61fa7260ac7d690d11ef72ca863e45a37c0bdc80/language/conpono/evals/classifier_utils.py#L572-L574
PokemonGoF/PokemonGo-Bot-Desktop
4bfa94f0183406c6a86f93645eff7abd3ad4ced8
build/pywin/Lib/email/charset.py
python
Charset.to_splittable
(self, s)
Convert a possibly multibyte string to a safely splittable format. Uses the input_codec to try and convert the string to Unicode, so it can be safely split on character boundaries (even for multibyte characters). Returns the string as-is if it isn't known how to convert it to U...
Convert a possibly multibyte string to a safely splittable format.
[ "Convert", "a", "possibly", "multibyte", "string", "to", "a", "safely", "splittable", "format", "." ]
def to_splittable(self, s): """Convert a possibly multibyte string to a safely splittable format. Uses the input_codec to try and convert the string to Unicode, so it can be safely split on character boundaries (even for multibyte characters). Returns the string as-is if it isn...
[ "def", "to_splittable", "(", "self", ",", "s", ")", ":", "if", "isinstance", "(", "s", ",", "unicode", ")", "or", "self", ".", "input_codec", "is", "None", ":", "return", "s", "try", ":", "return", "unicode", "(", "s", ",", "self", ".", "input_codec"...
https://github.com/PokemonGoF/PokemonGo-Bot-Desktop/blob/4bfa94f0183406c6a86f93645eff7abd3ad4ced8/build/pywin/Lib/email/charset.py#L277-L297
pydata/patsy
5fc881104b749b720b08e393a5505d6e69d72f95
patsy/missing.py
python
NAAction.is_numerical_NA
(self, arr)
return mask
Returns a 1-d mask array indicating which rows in an array of numerical values contain at least one NA value. Note that here `arr` is a numpy array or pandas DataFrame.
Returns a 1-d mask array indicating which rows in an array of numerical values contain at least one NA value.
[ "Returns", "a", "1", "-", "d", "mask", "array", "indicating", "which", "rows", "in", "an", "array", "of", "numerical", "values", "contain", "at", "least", "one", "NA", "value", "." ]
def is_numerical_NA(self, arr): """Returns a 1-d mask array indicating which rows in an array of numerical values contain at least one NA value. Note that here `arr` is a numpy array or pandas DataFrame.""" mask = np.zeros(arr.shape, dtype=bool) if "NaN" in self.NA_types: ...
[ "def", "is_numerical_NA", "(", "self", ",", "arr", ")", ":", "mask", "=", "np", ".", "zeros", "(", "arr", ".", "shape", ",", "dtype", "=", "bool", ")", "if", "\"NaN\"", "in", "self", ".", "NA_types", ":", "mask", "|=", "np", ".", "isnan", "(", "a...
https://github.com/pydata/patsy/blob/5fc881104b749b720b08e393a5505d6e69d72f95/patsy/missing.py#L129-L139
jhetherly/EnglishSpeechUpsampler
1265fa3ec68fa1e662b5d7f9c61ca730f9beee99
models.py
python
build_downsampling_block
(input_tensor, filter_size, stride, layer_number, act=tf.nn.relu, is_training=True, depth=None, padding='VALID', tens...
return l
[]
def build_downsampling_block(input_tensor, filter_size, stride, layer_number, act=tf.nn.relu, is_training=True, depth=None, padding='VALID', ...
[ "def", "build_downsampling_block", "(", "input_tensor", ",", "filter_size", ",", "stride", ",", "layer_number", ",", "act", "=", "tf", ".", "nn", ".", "relu", ",", "is_training", "=", "True", ",", "depth", "=", "None", ",", "padding", "=", "'VALID'", ",", ...
https://github.com/jhetherly/EnglishSpeechUpsampler/blob/1265fa3ec68fa1e662b5d7f9c61ca730f9beee99/models.py#L176-L214
saturday06/VRM_Addon_for_Blender
0fc59703bb203dca760501221d34ecc4a566e64f
io_scene_vrm/editor/vrm0/migration.py
python
migrate_vrm0_first_person
( first_person_props: bpy.types.PropertyGroup, first_person_dict: Any, )
[]
def migrate_vrm0_first_person( first_person_props: bpy.types.PropertyGroup, first_person_dict: Any, ) -> None: if not isinstance(first_person_dict, dict): return first_person_bone = first_person_dict.get("firstPersonBone") if isinstance(first_person_bone, str): first_person_props.fi...
[ "def", "migrate_vrm0_first_person", "(", "first_person_props", ":", "bpy", ".", "types", ".", "PropertyGroup", ",", "first_person_dict", ":", "Any", ",", ")", "->", "None", ":", "if", "not", "isinstance", "(", "first_person_dict", ",", "dict", ")", ":", "retur...
https://github.com/saturday06/VRM_Addon_for_Blender/blob/0fc59703bb203dca760501221d34ecc4a566e64f/io_scene_vrm/editor/vrm0/migration.py#L125-L195
bshillingford/python-torchfile
fbd434a5b5562c88b91a95e6476e11dbb7735436
torchfile.py
python
TorchObject.__dir__
(self)
return keys
[]
def __dir__(self): keys = list(self._obj.keys()) keys.append('torch_typename') return keys
[ "def", "__dir__", "(", "self", ")", ":", "keys", "=", "list", "(", "self", ".", "_obj", ".", "keys", "(", ")", ")", "keys", ".", "append", "(", "'torch_typename'", ")", "return", "keys" ]
https://github.com/bshillingford/python-torchfile/blob/fbd434a5b5562c88b91a95e6476e11dbb7735436/torchfile.py#L120-L123
pencil1/ApiTestManage
851a54d5629456b7e967e15186244409ddf783cc
app/models.py
python
User.init_user
()
[]
def init_user(): user = User.query.filter_by(name='管理员').first() if user: print('The administrator account already exists') print('--' * 30) return else: user = User(name=u'管理员', account='admin', password='123456', status=1, role_id=2) ...
[ "def", "init_user", "(", ")", ":", "user", "=", "User", ".", "query", ".", "filter_by", "(", "name", "=", "'管理员').firs", "t", "(", ")", "", "", "if", "user", ":", "print", "(", "'The administrator account already exists'", ")", "print", "(", "'--'", "*",...
https://github.com/pencil1/ApiTestManage/blob/851a54d5629456b7e967e15186244409ddf783cc/app/models.py#L126-L137
nucleic/enaml
65c2a2a2d765e88f2e1103046680571894bb41ed
enaml/qt/qt_color_dialog.py
python
QtColorDialog.set_custom_color
(index, color)
Set the custom color for the given index.
Set the custom color for the given index.
[ "Set", "the", "custom", "color", "for", "the", "given", "index", "." ]
def set_custom_color(index, color): """ Set the custom color for the given index. """ QColorDialog.setCustomColor(index, color.argb)
[ "def", "set_custom_color", "(", "index", ",", "color", ")", ":", "QColorDialog", ".", "setCustomColor", "(", "index", ",", "color", ".", "argb", ")" ]
https://github.com/nucleic/enaml/blob/65c2a2a2d765e88f2e1103046680571894bb41ed/enaml/qt/qt_color_dialog.py#L145-L149
PyHDI/veriloggen
2382d200deabf59cfcfd741f5eba371010aaf2bb
veriloggen/seq/seq.py
python
Seq.implement
(self)
[]
def implement(self): if self.as_module: self.make_module() return self.make_always()
[ "def", "implement", "(", "self", ")", ":", "if", "self", ".", "as_module", ":", "self", ".", "make_module", "(", ")", "return", "self", ".", "make_always", "(", ")" ]
https://github.com/PyHDI/veriloggen/blob/2382d200deabf59cfcfd741f5eba371010aaf2bb/veriloggen/seq/seq.py#L363-L368
openstack/neutron
fb229fb527ac8b95526412f7762d90826ac41428
neutron/db/l3_db.py
python
L3_NAT_db_mixin.disassociate_floatingips
(self, context, port_id, do_notify=True)
return router_ids
Disassociate all floating IPs linked to specific port. @param port_id: ID of the port to disassociate floating IPs. @param do_notify: whether we should notify routers right away. @return: set of router-ids that require notification updates if do_notify is False, otherwise None.
Disassociate all floating IPs linked to specific port.
[ "Disassociate", "all", "floating", "IPs", "linked", "to", "specific", "port", "." ]
def disassociate_floatingips(self, context, port_id, do_notify=True): """Disassociate all floating IPs linked to specific port. @param port_id: ID of the port to disassociate floating IPs. @param do_notify: whether we should notify routers right away. @return: set of router-ids that req...
[ "def", "disassociate_floatingips", "(", "self", ",", "context", ",", "port_id", ",", "do_notify", "=", "True", ")", ":", "router_ids", "=", "super", "(", "L3_NAT_db_mixin", ",", "self", ")", ".", "disassociate_floatingips", "(", "context", ",", "port_id", ",",...
https://github.com/openstack/neutron/blob/fb229fb527ac8b95526412f7762d90826ac41428/neutron/db/l3_db.py#L2155-L2171
pandaproject/panda
133baa47882a289773a30c9656e2ea4efe569387
panda/models/dataset.py
python
Dataset.import_data
(self, user, upload, external_id_field_index=None)
Import data into this ``Dataset`` from a given ``DataUpload``.
Import data into this ``Dataset`` from a given ``DataUpload``.
[ "Import", "data", "into", "this", "Dataset", "from", "a", "given", "DataUpload", "." ]
def import_data(self, user, upload, external_id_field_index=None): """ Import data into this ``Dataset`` from a given ``DataUpload``. """ self.lock() try: if upload.imported: raise DataImportError(_('This file has already been imported.')) ...
[ "def", "import_data", "(", "self", ",", "user", ",", "upload", ",", "external_id_field_index", "=", "None", ")", ":", "self", ".", "lock", "(", ")", "try", ":", "if", "upload", ".", "imported", ":", "raise", "DataImportError", "(", "_", "(", "'This file ...
https://github.com/pandaproject/panda/blob/133baa47882a289773a30c9656e2ea4efe569387/panda/models/dataset.py#L180-L225
dgilland/pydash
24ad0e43b51b367d00447c45baa68c9c03ad1a52
src/pydash/helpers.py
python
parse_iteratee
(iteratee_keyword, *args, **kwargs)
return iteratee, args
Try to find iteratee function passed in either as a keyword argument or as the last positional argument in `args`.
Try to find iteratee function passed in either as a keyword argument or as the last positional argument in `args`.
[ "Try", "to", "find", "iteratee", "function", "passed", "in", "either", "as", "a", "keyword", "argument", "or", "as", "the", "last", "positional", "argument", "in", "args", "." ]
def parse_iteratee(iteratee_keyword, *args, **kwargs): """Try to find iteratee function passed in either as a keyword argument or as the last positional argument in `args`.""" iteratee = kwargs.get(iteratee_keyword) last_arg = args[-1] if iteratee is None and ( callable(last_arg) or...
[ "def", "parse_iteratee", "(", "iteratee_keyword", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "iteratee", "=", "kwargs", ".", "get", "(", "iteratee_keyword", ")", "last_arg", "=", "args", "[", "-", "1", "]", "if", "iteratee", "is", "None", "an...
https://github.com/dgilland/pydash/blob/24ad0e43b51b367d00447c45baa68c9c03ad1a52/src/pydash/helpers.py#L236-L251