text
stringlengths
75
104k
code_tokens
list
avg_line_len
float64
7.91
980
score
float64
0
0.18
texts
list
scores
list
num_lines
int64
3
2.77k
avg_score
float64
0
0.37
def visit_Capture(self, node: parsing.Capture) -> [ast.stmt] or ast.expr: """Generates python code to capture text consumed by a clause. #If all clauses can be inlined self.beginTag('tagname') and clause and self.endTag('tagname') if not self.beginTag('tagname'): return Fal...
[ "def", "visit_Capture", "(", "self", ",", "node", ":", "parsing", ".", "Capture", ")", "->", "[", "ast", ".", "stmt", "]", "or", "ast", ".", "expr", ":", "begintag", "=", "ast", ".", "Attribute", "(", "ast", ".", "Name", "(", "'self'", ",", "ast", ...
38.285714
0.00182
[ "def visit_Capture(self, node: parsing.Capture) -> [ast.stmt] or ast.expr:\n", " \"\"\"Generates python code to capture text consumed by a clause.\n", "\n", " #If all clauses can be inlined\n", " self.beginTag('tagname') and clause and self.endTag('tagname')\n", "\n", " if no...
[ 0, 0.014084507042253521, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05555555555555555 ]
28
0.002487
def get_pstats_print2list(fnames, filter_fnames=None, exclude_fnames=None, sort=None, sort_reverse=None, limit=None): """Print stats with a filter or exclude filenames, sort index and limit. :param list fnames: cProfile standard files to process. :param list filter_fnames: Relative...
[ "def", "get_pstats_print2list", "(", "fnames", ",", "filter_fnames", "=", "None", ",", "exclude_fnames", "=", "None", ",", "sort", "=", "None", ",", "sort_reverse", "=", "None", ",", "limit", "=", "None", ")", ":", "if", "isinstance", "(", "fnames", ",", ...
41.432432
0.000319
[ "def get_pstats_print2list(fnames, filter_fnames=None, exclude_fnames=None,\n", " sort=None, sort_reverse=None, limit=None):\n", " \"\"\"Print stats with a filter or exclude filenames, sort index and limit.\n", " :param list fnames: cProfile standard files to process.\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
74
0.000265
def mtf_transformer_lm_baseline(): """Small language model to run on 1 TPU. Run this on 2x2 on languagemodel_lm1b32k_packed for 272000 steps (10 epochs) Results: params/10^9 log-ppl(per-token) 0.14 3.202 Returns: a hparams """ hparams = mtf_transformer_paper_lm(-1) hparams...
[ "def", "mtf_transformer_lm_baseline", "(", ")", ":", "hparams", "=", "mtf_transformer_paper_lm", "(", "-", "1", ")", "hparams", ".", "batch_size", "=", "128", "hparams", ".", "learning_rate_decay_steps", "=", "27200", "# one epoch on lm1b", "hparams", ".", "mesh_sha...
27.3125
0.015487
[ "def mtf_transformer_lm_baseline():\n", " \"\"\"Small language model to run on 1 TPU.\n", "\n", " Run this on 2x2 on languagemodel_lm1b32k_packed for 272000 steps (10 epochs)\n", " Results:\n", " params/10^9 log-ppl(per-token)\n", " 0.14 3.202\n", "\n", " Returns:\n", ...
[ 0, 0.023255813953488372, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.024390243902439025, 0.037037037037037035, 0.015384615384615385, 0.030303030303030304, 0.125 ]
16
0.015961
def whois_list(request, format=None): """ Retrieve basic whois information related to a layer2 or layer3 network address. """ results = [] # layer3 results for ip in Ip.objects.select_related().all(): interface = ip.interface user = interface.device.node.user device = int...
[ "def", "whois_list", "(", "request", ",", "format", "=", "None", ")", ":", "results", "=", "[", "]", "# layer3 results", "for", "ip", "in", "Ip", ".", "objects", ".", "select_related", "(", ")", ".", "all", "(", ")", ":", "interface", "=", "ip", ".",...
32.83871
0.001908
[ "def whois_list(request, format=None):\n", " \"\"\"\n", " Retrieve basic whois information related to a layer2 or layer3 network address.\n", " \"\"\"\n", " results = []\n", " # layer3 results\n", " for ip in Ip.objects.select_related().all():\n", " interface = ip.interface\n"...
[ 0, 0, 0.011904761904761904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03571428571428571 ]
31
0.001536
def load_modules(self, data=None, proxy=None): ''' Load the modules into the state ''' log.info('Loading fresh modules for state activity') self.utils = salt.loader.utils(self.opts) self.functions = salt.loader.minion_mods(self.opts, self.state_con, ...
[ "def", "load_modules", "(", "self", ",", "data", "=", "None", ",", "proxy", "=", "None", ")", ":", "log", ".", "info", "(", "'Loading fresh modules for state activity'", ")", "self", ".", "utils", "=", "salt", ".", "loader", ".", "utils", "(", "self", "....
49.454545
0.002404
[ "def load_modules(self, data=None, proxy=None):\n", " '''\n", " Load the modules into the state\n", " '''\n", " log.info('Loading fresh modules for state activity')\n", " self.utils = salt.loader.utils(self.opts)\n", " self.functions = salt.loader.minion_mods(se...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02127659574468085, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02 ]
33
0.003776
def handle_processing_packets(): """handle_processing_packets Replacement packet processing engine. This is not done. """ host = os.getenv( "LISTEN_ON_HOST", "127.0.0.1").strip().lstrip() port = int(os.getenv( "LISTEN_ON_PORT", "80").strip().lstrip()) backlog =...
[ "def", "handle_processing_packets", "(", ")", ":", "host", "=", "os", ".", "getenv", "(", "\"LISTEN_ON_HOST\"", ",", "\"127.0.0.1\"", ")", ".", "strip", "(", ")", ".", "lstrip", "(", ")", "port", "=", "int", "(", "os", ".", "getenv", "(", "\"LISTEN_ON_PO...
30.322981
0.000198
[ "def handle_processing_packets():\n", " \"\"\"handle_processing_packets\n", "\n", " Replacement packet processing engine. This is not done.\n", "\n", " \"\"\"\n", "\n", " host = os.getenv(\n", " \"LISTEN_ON_HOST\",\n", " \"127.0.0.1\").strip().lstrip()\n", " port = i...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
161
0.000311
def price_dataframe(symbols='sp5002012', start=datetime.datetime(2008, 1, 1), end=datetime.datetime(2009, 12, 31), price_type='actual_close', cleaner=clean_dataframe, ): """Retrieve the prices of a list of equities as a DataFrame (columns = symbols) Arguments: symbols (list of str):...
[ "def", "price_dataframe", "(", "symbols", "=", "'sp5002012'", ",", "start", "=", "datetime", ".", "datetime", "(", "2008", ",", "1", ",", "1", ")", ",", "end", "=", "datetime", ".", "datetime", "(", "2009", ",", "12", ",", "31", ")", ",", "price_type...
41.461538
0.00816
[ "def price_dataframe(symbols='sp5002012',\n", " start=datetime.datetime(2008, 1, 1),\n", " end=datetime.datetime(2009, 12, 31), \n", " price_type='actual_close',\n", " cleaner=clean_dataframe,\n", " ):\n", " \"\"\"Retrieve the prices of a list of equities as a DataFrame (columns = sym...
[ 0, 0.024390243902439025, 0.046511627906976744, 0.03225806451612903, 0.034482758620689655, 0.2857142857142857, 0.011904761904761904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.034482758620689655 ]
26
0.018067
def disvec(self, x, y, aq=None): '''Returns array of size (2, nparam, naq)''' if aq is None: aq = self.model.aq.find_aquifer_data(x, y) return np.sum(self.parameters * self.disvecinf(x, y, aq), 1)
[ "def", "disvec", "(", "self", ",", "x", ",", "y", ",", "aq", "=", "None", ")", ":", "if", "aq", "is", "None", ":", "aq", "=", "self", ".", "model", ".", "aq", ".", "find_aquifer_data", "(", "x", ",", "y", ")", "return", "np", ".", "sum", "(",...
54.25
0.013636
[ "def disvec(self, x, y, aq=None):\n", " '''Returns array of size (2, nparam, naq)'''\n", " if aq is None: aq = self.model.aq.find_aquifer_data(x, y)\n", " return np.sum(self.parameters * self.disvecinf(x, y, aq), 1)" ]
[ 0, 0.018867924528301886, 0.015151515151515152, 0.014705882352941176 ]
4
0.012181
def parse_localclasspath(self, tup_tree): """ Parse a LOCALCLASSPATH element and return the class path it represents as a CIMClassName object. :: <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)> """ self.check_node(tup_tree, 'LOCALCLASSPATH') ...
[ "def", "parse_localclasspath", "(", "self", ",", "tup_tree", ")", ":", "self", ".", "check_node", "(", "tup_tree", ",", "'LOCALCLASSPATH'", ")", "k", "=", "kids", "(", "tup_tree", ")", "if", "len", "(", "k", ")", "!=", "2", ":", "raise", "CIMXMLParseErro...
31.230769
0.002389
[ "def parse_localclasspath(self, tup_tree):\n", " \"\"\"\n", " Parse a LOCALCLASSPATH element and return the class path it represents\n", " as a CIMClassName object.\n", "\n", " ::\n", "\n", " <!ELEMENT LOCALCLASSPATH (LOCALNAMESPACEPATH, CLASSNAME)>\n", " ...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04 ]
26
0.004744
def is_highlink_density(self, element): """ checks the density of links within a node, is there not much text and most of it contains linky shit? if so it's no good """ links = self.parser.getElementsByTag(element, tag='a') if not links: return False ...
[ "def", "is_highlink_density", "(", "self", ",", "element", ")", ":", "links", "=", "self", ".", "parser", ".", "getElementsByTag", "(", "element", ",", "tag", "=", "'a'", ")", "if", "not", "links", ":", "return", "False", "text", "=", "self", ".", "par...
34.807692
0.002151
[ "def is_highlink_density(self, element):\n", " \"\"\"\n", " checks the density of links within a node,\n", " is there not much text and most of it contains linky shit?\n", " if so it's no good\n", " \"\"\"\n", " links = self.parser.getElementsByTag(element, tag=...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05 ]
26
0.005128
def random_link(self, dataset, state, backward=False): """Get a random link. Parameters ---------- dataset : `object` Dataset from `self.get_dataset()`. state : `object` Link source. backward : `bool`, optional Link direction. ...
[ "def", "random_link", "(", "self", ",", "dataset", ",", "state", ",", "backward", "=", "False", ")", ":", "links", "=", "self", ".", "get_links", "(", "dataset", ",", "state", ",", "backward", ")", "if", "not", "links", ":", "return", "None", ",", "N...
27.78125
0.002174
[ "def random_link(self, dataset, state, backward=False):\n", " \"\"\"Get a random link.\n", "\n", " Parameters\n", " ----------\n", " dataset : `object`\n", " Dataset from `self.get_dataset()`.\n", " state : `object`\n", " Link source.\n", " ...
[ 0, 0.03333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.021739130434782608 ]
32
0.001721
def copystat(self, target): """Copies the permissions, times and flags from this to the `target`. The owner is not copied. """ shutil.copystat(self.path, self._to_backend(target))
[ "def", "copystat", "(", "self", ",", "target", ")", ":", "shutil", ".", "copystat", "(", "self", ".", "path", ",", "self", ".", "_to_backend", "(", "target", ")", ")" ]
34.5
0.009434
[ "def copystat(self, target):\n", " \"\"\"Copies the permissions, times and flags from this to the `target`.\n", "\n", " The owner is not copied.\n", " \"\"\"\n", " shutil.copystat(self.path, self._to_backend(target))" ]
[ 0, 0.01282051282051282, 0, 0, 0, 0.016666666666666666 ]
6
0.004915
def pb_for_delete(document_path, option): """Make a ``Write`` protobuf for ``delete()`` methods. Args: document_path (str): A fully-qualified document path. option (optional[~.firestore_v1beta1.client.WriteOption]): A write option to make assertions / preconditions on the server ...
[ "def", "pb_for_delete", "(", "document_path", ",", "option", ")", ":", "write_pb", "=", "write_pb2", ".", "Write", "(", "delete", "=", "document_path", ")", "if", "option", "is", "not", "None", ":", "option", ".", "modify_write", "(", "write_pb", ")", "ret...
34.944444
0.001548
[ "def pb_for_delete(document_path, option):\n", " \"\"\"Make a ``Write`` protobuf for ``delete()`` methods.\n", "\n", " Args:\n", " document_path (str): A fully-qualified document path.\n", " option (optional[~.firestore_v1beta1.client.WriteOption]): A\n", " write option to ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05263157894736842 ]
18
0.002924
def _convert_filetime_to_timestamp(filetime): """ Windows returns times as 64-bit unsigned longs that are the number of hundreds of nanoseconds since Jan 1 1601. This converts it to a datetime object. :param filetime: A FILETIME struct object :return: An integer unix timestamp ...
[ "def", "_convert_filetime_to_timestamp", "(", "filetime", ")", ":", "hundreds_nano_seconds", "=", "struct", ".", "unpack", "(", "b'>Q'", ",", "struct", ".", "pack", "(", "b'>LL'", ",", "filetime", ".", "dwHighDateTime", ",", "filetime", ".", "dwLowDateTime", ")"...
26
0.001613
[ "def _convert_filetime_to_timestamp(filetime):\n", " \"\"\"\n", " Windows returns times as 64-bit unsigned longs that are the number\n", " of hundreds of nanoseconds since Jan 1 1601. This converts it to\n", " a datetime object.\n", "\n", " :param filetime:\n", " A FILETIME struc...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.023255813953488372 ]
23
0.001011
def modulename(cls, depth=1): """ get caller's __name__ """ depth += cls.extra_depth frame = sys._getframe(depth) return frame.f_globals['__name__']
[ "def", "modulename", "(", "cls", ",", "depth", "=", "1", ")", ":", "depth", "+=", "cls", ".", "extra_depth", "frame", "=", "sys", ".", "_getframe", "(", "depth", ")", "return", "frame", ".", "f_globals", "[", "'__name__'", "]" ]
27.142857
0.010204
[ "def modulename(cls, depth=1):\n", " \"\"\"\n", " get caller's __name__\n", " \"\"\"\n", " depth += cls.extra_depth\n", " frame = sys._getframe(depth)\n", " return frame.f_globals['__name__']" ]
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0.023809523809523808 ]
7
0.015306
def _synthesize_multiple_generic(self, helper_function, text_file, output_file_path, quit_after=None, backwards=False): """ Synthesize multiple fragments, generic function. The ``helper_function`` is a function that takes parameters ``(text, voice_code, output_file_path)`` and r...
[ "def", "_synthesize_multiple_generic", "(", "self", ",", "helper_function", ",", "text_file", ",", "output_file_path", ",", "quit_after", "=", "None", ",", "backwards", "=", "False", ")", ":", "self", ".", "log", "(", "u\"Calling TTS engine using multiple generic func...
44.938776
0.002222
[ "def _synthesize_multiple_generic(self, helper_function, text_file, output_file_path, quit_after=None, backwards=False):\n", " \"\"\"\n", " Synthesize multiple fragments, generic function.\n", "\n", " The ``helper_function`` is a function that takes parameters\n", " ``(text, vo...
[ 0.008333333333333333, 0.08333333333333333, 0, 0, 0, 0, 0, 0.011627906976744186, 0, 0, 0, 0, 0, 0, 0, 0.011494252873563218, 0, 0, 0, 0, 0, 0, 0, 0.012195121951219513, 0, 0, 0.012048192771084338, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
98
0.001935
def convertImages(self): """ run this to turn all folder1 TIFs and JPGs into folder2 data. TIFs will be treated as micrographs and converted to JPG with enhanced contrast. JPGs will simply be copied over. """ # copy over JPGs (and such) exts=['.jpg','.png'] ...
[ "def", "convertImages", "(", "self", ")", ":", "# copy over JPGs (and such)", "exts", "=", "[", "'.jpg'", ",", "'.png'", "]", "for", "fname", "in", "[", "x", "for", "x", "in", "self", ".", "files1", "if", "cm", ".", "ext", "(", "x", ")", "in", "exts"...
44.4375
0.01927
[ "def convertImages(self):\n", " \"\"\"\n", " run this to turn all folder1 TIFs and JPGs into folder2 data.\n", " TIFs will be treated as micrographs and converted to JPG with enhanced\n", " contrast. JPGs will simply be copied over.\n", " \"\"\"\n", "\n", " # ...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0.06896551724137931, 0, 0.04, 0.01818181818181818, 0.034482758620689655, 0.027777777777777776, 0.023809523809523808, 0.017241379310344827, 0.041666666666666664, 0, 0.017543859649122806, 0, 0, 0.06666666666666667, 0, 0.04, 0.01...
32
0.020825
def value_counts(self, dropna=True): """ Returns a Series containing counts of unique values. Parameters ---------- dropna : boolean, default True Don't include counts of NaN, even if NaN is in sp_values. Returns ------- counts : Series ...
[ "def", "value_counts", "(", "self", ",", "dropna", "=", "True", ")", ":", "from", "pandas", "import", "Index", ",", "Series", "keys", ",", "counts", "=", "algos", ".", "_value_counts_arraylike", "(", "self", ".", "sp_values", ",", "dropna", "=", "dropna", ...
30.756757
0.001704
[ "def value_counts(self, dropna=True):\n", " \"\"\"\n", " Returns a Series containing counts of unique values.\n", "\n", " Parameters\n", " ----------\n", " dropna : boolean, default True\n", " Don't include counts of NaN, even if NaN is in sp_values.\n", ...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.047619047619047616 ]
37
0.003539
def get_last(self): """ Get the last migration batch. :rtype: list """ query = self.table().where('batch', self.get_last_batch_number()) return query.order_by('migration', 'desc').get()
[ "def", "get_last", "(", "self", ")", ":", "query", "=", "self", ".", "table", "(", ")", ".", "where", "(", "'batch'", ",", "self", ".", "get_last_batch_number", "(", ")", ")", "return", "query", ".", "order_by", "(", "'migration'", ",", "'desc'", ")", ...
25.222222
0.008511
[ "def get_last(self):\n", " \"\"\"\n", " Get the last migration batch.\n", "\n", " :rtype: list\n", " \"\"\"\n", " query = self.table().where('batch', self.get_last_batch_number())\n", "\n", " return query.order_by('migration', 'desc').get()" ]
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0.017857142857142856 ]
9
0.011243
def refresh(self, token, timeout=None): """Set new timeout for lock, if existing and valid.""" if timeout is None: timeout = LockManager.LOCK_TIME_OUT_DEFAULT return self.storage.refresh(token, timeout)
[ "def", "refresh", "(", "self", ",", "token", ",", "timeout", "=", "None", ")", ":", "if", "timeout", "is", "None", ":", "timeout", "=", "LockManager", ".", "LOCK_TIME_OUT_DEFAULT", "return", "self", ".", "storage", ".", "refresh", "(", "token", ",", "tim...
46.8
0.008403
[ "def refresh(self, token, timeout=None):\n", " \"\"\"Set new timeout for lock, if existing and valid.\"\"\"\n", " if timeout is None:\n", " timeout = LockManager.LOCK_TIME_OUT_DEFAULT\n", " return self.storage.refresh(token, timeout)" ]
[ 0, 0.015873015873015872, 0, 0, 0.0196078431372549 ]
5
0.007096
def gradev(data, rate=1.0, data_type="phase", taus=None, ci=0.9, noisetype='wp'): """ gap resistant overlapping Allan deviation Parameters ---------- data: np.array Input data. Provide either phase or frequency (fractional, adimensional). Warning : phase data works better (fr...
[ "def", "gradev", "(", "data", ",", "rate", "=", "1.0", ",", "data_type", "=", "\"phase\"", ",", "taus", "=", "None", ",", "ci", "=", "0.9", ",", "noisetype", "=", "'wp'", ")", ":", "if", "(", "data_type", "==", "\"freq\"", ")", ":", "print", "(", ...
36.942857
0.000377
[ "def gradev(data, rate=1.0, data_type=\"phase\", taus=None,\n", " ci=0.9, noisetype='wp'):\n", " \"\"\" gap resistant overlapping Allan deviation\n", "\n", " Parameters\n", " ----------\n", " data: np.array\n", " Input data. Provide either phase or frequency (fractional,\n...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
70
0.00023
def U(self): "Seconds since the Unix epoch (January 1 1970 00:00:00 GMT)" if getattr(self.data, 'tzinfo', None): return int(calendar.timegm(self.data.utctimetuple())) else: return int(time.mktime(self.data.timetuple()))
[ "def", "U", "(", "self", ")", ":", "if", "getattr", "(", "self", ".", "data", ",", "'tzinfo'", ",", "None", ")", ":", "return", "int", "(", "calendar", ".", "timegm", "(", "self", ".", "data", ".", "utctimetuple", "(", ")", ")", ")", "else", ":",...
39.666667
0.012346
[ "def U(self):\n", " \"Seconds since the Unix epoch (January 1 1970 00:00:00 GMT)\"\n", " if getattr(self.data, 'tzinfo', None):\n", " return int(calendar.timegm(self.data.utctimetuple()))\n", " else:\n", " return int(time.mktime(self.data.timetuple()))" ]
[ 0, 0, 0, 0.016666666666666666, 0, 0.038461538461538464 ]
6
0.009188
def paga_adjacency( adata, adjacency='connectivities', adjacency_tree='connectivities_tree', as_heatmap=True, color_map=None, show=None, save=None): """Connectivity of paga groups. """ connectivity = adata.uns[adjacency].toarray() connectivity_sele...
[ "def", "paga_adjacency", "(", "adata", ",", "adjacency", "=", "'connectivities'", ",", "adjacency_tree", "=", "'connectivities_tree'", ",", "as_heatmap", "=", "True", ",", "color_map", "=", "None", ",", "show", "=", "None", ",", "save", "=", "None", ")", ":"...
38.821429
0.000898
[ "def paga_adjacency(\n", " adata,\n", " adjacency='connectivities',\n", " adjacency_tree='connectivities_tree',\n", " as_heatmap=True,\n", " color_map=None,\n", " show=None,\n", " save=None):\n", " \"\"\"Connectivity of paga groups.\n", " \"\"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.014705882352941176 ]
28
0.000525
def _get_filehandler_with_formatter(logname, formatter=None): """ Return a logging FileHandler for given logname using a given logging formatter :param logname: Name of the file where logs will be stored, ".log" extension will be added :param formatter: An instance of logging.Formatter or None if th...
[ "def", "_get_filehandler_with_formatter", "(", "logname", ",", "formatter", "=", "None", ")", ":", "handler", "=", "logging", ".", "FileHandler", "(", "logname", ")", "if", "formatter", "is", "not", "None", ":", "handler", ".", "setFormatter", "(", "formatter"...
37.615385
0.001996
[ "def _get_filehandler_with_formatter(logname, formatter=None):\n", " \"\"\" Return a logging FileHandler for given logname using a given\n", " logging formatter\n", " :param logname: Name of the file where logs will be stored, \".log\"\n", " extension will be added\n", " :param formatter: A...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05555555555555555 ]
13
0.004274
def _validate_frequency(cls, index, freq, **kwargs): """ Validate that a frequency is compatible with the values of a given Datetime Array/Index or Timedelta Array/Index Parameters ---------- index : DatetimeIndex or TimedeltaIndex The index on which to deter...
[ "def", "_validate_frequency", "(", "cls", ",", "index", ",", "freq", ",", "*", "*", "kwargs", ")", ":", "if", "is_period_dtype", "(", "cls", ")", ":", "# Frequency validation is not meaningful for Period Array/Index", "return", "None", "inferred", "=", "index", "....
44.25641
0.001134
[ "def _validate_frequency(cls, index, freq, **kwargs):\n", " \"\"\"\n", " Validate that a frequency is compatible with the values of a given\n", " Datetime Array/Index or Timedelta Array/Index\n", "\n", " Parameters\n", " ----------\n", " index : DatetimeIndex ...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.013513513513513514 ]
39
0.002483
def stream_bytes(data, chunk_size=default_chunk_size): """Gets a buffered generator for streaming binary data. Returns a buffered generator which encodes binary data as :mimetype:`multipart/form-data` with the corresponding headers. Parameters ---------- data : bytes The data bytes to ...
[ "def", "stream_bytes", "(", "data", ",", "chunk_size", "=", "default_chunk_size", ")", ":", "stream", "=", "BytesStream", "(", "data", ",", "chunk_size", "=", "chunk_size", ")", "return", "stream", ".", "body", "(", ")", ",", "stream", ".", "headers" ]
26.45
0.001825
[ "def stream_bytes(data, chunk_size=default_chunk_size):\n", " \"\"\"Gets a buffered generator for streaming binary data.\n", "\n", " Returns a buffered generator which encodes binary data as\n", " :mimetype:`multipart/form-data` with the corresponding headers.\n", "\n", " Parameters\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.025 ]
20
0.00125
def compute_screen_line_counts( feed: "Feed", linestring: LineString, dates: List[str], geo_shapes=None ) -> DataFrame: """ Find all the Feed trips active on the given dates that intersect the given Shapely LineString (with WGS84 longitude-latitude coordinates). Parameters ---------- fe...
[ "def", "compute_screen_line_counts", "(", "feed", ":", "\"Feed\"", ",", "linestring", ":", "LineString", ",", "dates", ":", "List", "[", "str", "]", ",", "geo_shapes", "=", "None", ")", "->", "DataFrame", ":", "dates", "=", "feed", ".", "restrict_dates", "...
37.584795
0.000152
[ "def compute_screen_line_counts(\n", " feed: \"Feed\", linestring: LineString, dates: List[str], geo_shapes=None\n", ") -> DataFrame:\n", " \"\"\"\n", " Find all the Feed trips active on the given dates\n", " that intersect the given Shapely LineString (with WGS84\n", " longitude-latitude...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
171
0.000487
def pposition(hd, details=False): """Parse string into angular position. A string containing 2 or 6 numbers is parsed, and the numbers are converted into decimal numbers. In the former case the numbers are assumed to be floats. In the latter case, the numbers are assumed to be sexagesimal. Par...
[ "def", "pposition", "(", "hd", ",", "details", "=", "False", ")", ":", "# :TODO: split two angles based on user entered separator and process each part separately.", "# Split at any character other than a digit, \".\", \"-\", and \"+\".", "p", "=", "re", ".", "split", "(", "r\"[^...
28.876289
0.00069
[ "def pposition(hd, details=False):\n", " \"\"\"Parse string into angular position.\n", "\n", " A string containing 2 or 6 numbers is parsed, and the numbers are\n", " converted into decimal numbers. In the former case the numbers are\n", " assumed to be floats. In the latter case, the numbers ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0...
97
0.000714
def get_command(self, command): """Helper function for osx - return gnu utils rather than default for eg head and md5sum where possible and needed. """ shutit_global.shutit_global_object.yield_to_draw() if command in ('md5sum','sed','head'): if self.get_current_shutit_pexpect_session_environment().distr...
[ "def", "get_command", "(", "self", ",", "command", ")", ":", "shutit_global", ".", "shutit_global_object", ".", "yield_to_draw", "(", ")", "if", "command", "in", "(", "'md5sum'", ",", "'sed'", ",", "'head'", ")", ":", "if", "self", ".", "get_current_shutit_p...
40.555556
0.034853
[ "def get_command(self, command):\n", "\t\t\"\"\"Helper function for osx - return gnu utils rather than default for\n", "\t\t eg head and md5sum where possible and needed.\n", "\t\t\"\"\"\n", "\t\tshutit_global.shutit_global_object.yield_to_draw()\n", "\t\tif command in ('md5sum','sed','head'):\n", "\t...
[ 0, 0.027777777777777776, 0.0392156862745098, 0.16666666666666666, 0.018867924528301886, 0.07317073170731707, 0.012987012987012988, 0.04, 0.125 ]
9
0.055965
def _normalizeImpurityMatrix(matrix): """Normalize each row of the matrix that the sum of the row equals 1. :params matrix: a matrix (2d nested list) containing numbers, each isobaric channel must be present as a row. :returns: a matrix containing normalized values """ newMatrix = list() ...
[ "def", "_normalizeImpurityMatrix", "(", "matrix", ")", ":", "newMatrix", "=", "list", "(", ")", "for", "line", "in", "matrix", ":", "total", "=", "sum", "(", "line", ")", "if", "total", "!=", "0", ":", "newMatrix", ".", "append", "(", "[", "i", "/", ...
33.466667
0.001938
[ "def _normalizeImpurityMatrix(matrix):\n", " \"\"\"Normalize each row of the matrix that the sum of the row equals 1.\n", "\n", " :params matrix: a matrix (2d nested list) containing numbers, each isobaric\n", " channel must be present as a row.\n", " :returns: a matrix containing normaliz...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05 ]
15
0.003333
def select_right(self): """move cursor right""" r, c = self._index self._select_index(r, c+1)
[ "def", "select_right", "(", "self", ")", ":", "r", ",", "c", "=", "self", ".", "_index", "self", ".", "_select_index", "(", "r", ",", "c", "+", "1", ")" ]
28.5
0.017094
[ "def select_right(self):\n", " \"\"\"move cursor right\"\"\"\n", " r, c = self._index\n", " self._select_index(r, c+1)" ]
[ 0, 0.03125, 0, 0.029411764705882353 ]
4
0.015165
def _get_variable_value(defined_variables, name): """ Call the function provided on the defined_variables object with the given name (raise exception if that doesn't exist) and casts it to the specified type. Returns an instance of operators.BaseType """ def fallback(*args, **kwargs): r...
[ "def", "_get_variable_value", "(", "defined_variables", ",", "name", ")", ":", "def", "fallback", "(", "*", "args", ",", "*", "*", "kwargs", ")", ":", "raise", "AssertionError", "(", "\"Variable {0} is not defined in class {1}\"", ".", "format", "(", "name", ","...
42.153846
0.001786
[ "def _get_variable_value(defined_variables, name):\n", " \"\"\" Call the function provided on the defined_variables object with the\n", " given name (raise exception if that doesn't exist) and casts it to the\n", " specified type.\n", "\n", " Returns an instance of operators.BaseType\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.030303030303030304 ]
13
0.002331
def _parse_docstring(fh): """Parse the docstrings of a script to find marked dependencies.""" find_fades = re.compile(r'\b(fades)\b:').search for line in fh: if line.startswith("'"): quote = "'" break if line.startswith('"'): quote = '"' break...
[ "def", "_parse_docstring", "(", "fh", ")", ":", "find_fades", "=", "re", ".", "compile", "(", "r'\\b(fades)\\b:'", ")", ".", "search", "for", "line", "in", "fh", ":", "if", "line", ".", "startswith", "(", "\"'\"", ")", ":", "quote", "=", "\"'\"", "brea...
26
0.000976
[ "def _parse_docstring(fh):\n", " \"\"\"Parse the docstrings of a script to find marked dependencies.\"\"\"\n", " find_fades = re.compile(r'\\b(fades)\\b:').search\n", "\n", " for line in fh:\n", " if line.startswith(\"'\"):\n", " quote = \"'\"\n", " break\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.019230769230769232 ]
38
0.000506
def segment_curvature(self, t, use_inf=False): """returns the curvature of the segment at t. Notes ----- If you receive a RuntimeWarning, run command >>> old = np.seterr(invalid='raise') This can be undone with >>> np.seterr(**old) """ dz = self.derivative(t) ddz = self.derivat...
[ "def", "segment_curvature", "(", "self", ",", "t", ",", "use_inf", "=", "False", ")", ":", "dz", "=", "self", ".", "derivative", "(", "t", ")", "ddz", "=", "self", ".", "derivative", "(", "t", ",", "n", "=", "2", ")", "dx", ",", "dy", "=", "dz"...
30.147059
0.000945
[ "def segment_curvature(self, t, use_inf=False):\n", " \"\"\"returns the curvature of the segment at t.\n", "\n", " Notes\n", " -----\n", " If you receive a RuntimeWarning, run command\n", " >>> old = np.seterr(invalid='raise')\n", " This can be undone with\n", " >>> np.seterr(**...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0625 ]
34
0.001838
def MAFFT(sequences, gap_open=1.53, gap_extension=0.0, retree=2): '''A Coral wrapper for the MAFFT command line multiple sequence aligner. :param sequences: A list of sequences to align. :type sequences: List of homogeneous sequences (all DNA, or all RNA, etc.) :param gap_open: --o...
[ "def", "MAFFT", "(", "sequences", ",", "gap_open", "=", "1.53", ",", "gap_extension", "=", "0.0", ",", "retree", "=", "2", ")", ":", "arguments", "=", "[", "'mafft'", "]", "arguments", "+=", "[", "'--op'", ",", "str", "(", "gap_open", ")", "]", "argu...
36.212766
0.000572
[ "def MAFFT(sequences, gap_open=1.53, gap_extension=0.0, retree=2):\n", " '''A Coral wrapper for the MAFFT command line multiple sequence aligner.\n", "\n", " :param sequences: A list of sequences to align.\n", " :type sequences: List of homogeneous sequences (all DNA, or all RNA,\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.043478260869565216 ]
47
0.000925
def cmpToDataStore_uri(base, ds1, ds2): '''Bases the comparison of the datastores on URI alone.''' ret = difflib.get_close_matches(base.uri, [ds1.uri, ds2.uri], 1, cutoff=0.5) if len(ret) <= 0: return 0 if ret[0] == ds1.uri: return -1 return 1
[ "def", "cmpToDataStore_uri", "(", "base", ",", "ds1", ",", "ds2", ")", ":", "ret", "=", "difflib", ".", "get_close_matches", "(", "base", ".", "uri", ",", "[", "ds1", ".", "uri", ",", "ds2", ".", "uri", "]", ",", "1", ",", "cutoff", "=", "0.5", "...
31.75
0.022989
[ "def cmpToDataStore_uri(base, ds1, ds2):\n", " '''Bases the comparison of the datastores on URI alone.'''\n", " ret = difflib.get_close_matches(base.uri, [ds1.uri, ds2.uri], 1, cutoff=0.5)\n", " if len(ret) <= 0:\n", " return 0\n", " if ret[0] == ds1.uri:\n", " return -1\n", " return 1" ]
[ 0, 0.01639344262295082, 0.012658227848101266, 0.05, 0, 0.041666666666666664, 0, 0.2 ]
8
0.04009
def get_pydoc_completions(modulename): """Get possible completions for modulename for pydoc. Returns a list of possible values to be passed to pydoc. """ modulename = compat.ensure_not_unicode(modulename) modulename = modulename.rstrip(".") if modulename == "": return sorted(get_module...
[ "def", "get_pydoc_completions", "(", "modulename", ")", ":", "modulename", "=", "compat", ".", "ensure_not_unicode", "(", "modulename", ")", "modulename", "=", "modulename", ".", "rstrip", "(", "\".\"", ")", "if", "modulename", "==", "\"\"", ":", "return", "so...
33.238095
0.001393
[ "def get_pydoc_completions(modulename):\n", " \"\"\"Get possible completions for modulename for pydoc.\n", "\n", " Returns a list of possible values to be passed to pydoc.\n", "\n", " \"\"\"\n", " modulename = compat.ensure_not_unicode(modulename)\n", " modulename = modulename.rstrip(\"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02 ]
21
0.000952
def get_condition(self, service_id, version_number, name): """Gets a specified condition.""" content = self._fetch("/service/%s/version/%d/condition/%s" % (service_id, version_number, name)) return FastlyCondition(self, content)
[ "def", "get_condition", "(", "self", ",", "service_id", ",", "version_number", ",", "name", ")", ":", "content", "=", "self", ".", "_fetch", "(", "\"/service/%s/version/%d/condition/%s\"", "%", "(", "service_id", ",", "version_number", ",", "name", ")", ")", "...
57.75
0.025641
[ "def get_condition(self, service_id, version_number, name):\n", "\t\t\"\"\"Gets a specified condition.\"\"\"\n", "\t\tcontent = self._fetch(\"/service/%s/version/%d/condition/%s\" % (service_id, version_number, name))\n", "\t\treturn FastlyCondition(self, content)" ]
[ 0, 0.05555555555555555, 0.02, 0.05128205128205128 ]
4
0.031709
def Rank(a): """ Rank op. """ return np.array([len(a.shape)], dtype=np.int32),
[ "def", "Rank", "(", "a", ")", ":", "return", "np", ".", "array", "(", "[", "len", "(", "a", ".", "shape", ")", "]", ",", "dtype", "=", "np", ".", "int32", ")", "," ]
18
0.010638
[ "def Rank(a):\n", " \"\"\"\n", " Rank op.\n", " \"\"\"\n", " return np.array([len(a.shape)], dtype=np.int32)," ]
[ 0, 0, 0, 0, 0.019230769230769232 ]
5
0.003846
def process_connection(connection, my_socket): """Handle I/O and Timers on a single Connection.""" if connection.closed: return False work = False readfd = [] writefd = [] if connection.needs_input > 0: readfd = [my_socket] work = True if connection.has_output > 0: ...
[ "def", "process_connection", "(", "connection", ",", "my_socket", ")", ":", "if", "connection", ".", "closed", ":", "return", "False", "work", "=", "False", "readfd", "=", "[", "]", "writefd", "=", "[", "]", "if", "connection", ".", "needs_input", ">", "...
29.489796
0.00067
[ "def process_connection(connection, my_socket):\n", " \"\"\"Handle I/O and Timers on a single Connection.\"\"\"\n", " if connection.closed:\n", " return False\n", "\n", " work = False\n", " readfd = []\n", " writefd = []\n", " if connection.needs_input > 0:\n", " re...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.06666666666666667 ]
49
0.001361
def take(list_, index_list): """ Selects a subset of a list based on a list of indices. This is similar to np.take, but pure python. Args: list_ (list): some indexable object index_list (list, slice, int): some indexing object Returns: list or scalar: subset of the list ...
[ "def", "take", "(", "list_", ",", "index_list", ")", ":", "try", ":", "return", "[", "list_", "[", "index", "]", "for", "index", "in", "index_list", "]", "except", "TypeError", ":", "return", "list_", "[", "index_list", "]" ]
24.365385
0.000759
[ "def take(list_, index_list):\n", " \"\"\"\n", " Selects a subset of a list based on a list of indices.\n", " This is similar to np.take, but pure python.\n", "\n", " Args:\n", " list_ (list): some indexable object\n", " index_list (list, slice, int): some indexing object\n",...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03125 ]
52
0.000601
def download_as_file(fn, data=None): """ Download given `data` as file `fn`. This service exists to allow frontend present user with downloadable files. """ if data is None: raise HTTPError(500, "This service require POST `data` parameter.") response.set_header("Content-Type", "applicat...
[ "def", "download_as_file", "(", "fn", ",", "data", "=", "None", ")", ":", "if", "data", "is", "None", ":", "raise", "HTTPError", "(", "500", ",", "\"This service require POST `data` parameter.\"", ")", "response", ".", "set_header", "(", "\"Content-Type\"", ",",...
30.266667
0.002137
[ "def download_as_file(fn, data=None):\n", " \"\"\"\n", " Download given `data` as file `fn`. This service exists to allow frontend\n", " present user with downloadable files.\n", " \"\"\"\n", " if data is None:\n", " raise HTTPError(500, \"This service require POST `data` parameter...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.04 ]
15
0.002667
def _EncodeUnknownFields(message): """Remap unknown fields in message out of message.source.""" source = _UNRECOGNIZED_FIELD_MAPPINGS.get(type(message)) if source is None: return message # CopyProtoMessage uses _ProtoJsonApiTools, which uses this message. Use # the vanilla protojson-based co...
[ "def", "_EncodeUnknownFields", "(", "message", ")", ":", "source", "=", "_UNRECOGNIZED_FIELD_MAPPINGS", ".", "get", "(", "type", "(", "message", ")", ")", "if", "source", "is", "None", ":", "return", "message", "# CopyProtoMessage uses _ProtoJsonApiTools, which uses t...
46.772727
0.000952
[ "def _EncodeUnknownFields(message):\n", " \"\"\"Remap unknown fields in message out of message.source.\"\"\"\n", " source = _UNRECOGNIZED_FIELD_MAPPINGS.get(type(message))\n", " if source is None:\n", " return message\n", " # CopyProtoMessage uses _ProtoJsonApiTools, which uses this mes...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.058823529411764705 ]
22
0.002674
def process_from_file(signor_data_file, signor_complexes_file=None): """Process Signor interaction data from CSV files. Parameters ---------- signor_data_file : str Path to the Signor interaction data file in CSV format. signor_complexes_file : str Path to the Signor complexes data ...
[ "def", "process_from_file", "(", "signor_data_file", ",", "signor_complexes_file", "=", "None", ")", ":", "# Get generator over the CSV file", "data_iter", "=", "read_unicode_csv", "(", "signor_data_file", ",", "delimiter", "=", "';'", ",", "skiprows", "=", "1", ")", ...
41.538462
0.000905
[ "def process_from_file(signor_data_file, signor_complexes_file=None):\n", " \"\"\"Process Signor interaction data from CSV files.\n", "\n", " Parameters\n", " ----------\n", " signor_data_file : str\n", " Path to the Signor interaction data file in CSV format.\n", " signor_comple...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.017241379310344827 ]
26
0.000663
def lowstate_file_refs(chunks, extras=''): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: if not isinstance(chunk, dict): continue saltenv = 'base' crefs = [] for state in chunk: if state == '__env__': ...
[ "def", "lowstate_file_refs", "(", "chunks", ",", "extras", "=", "''", ")", ":", "refs", "=", "{", "}", "for", "chunk", "in", "chunks", ":", "if", "not", "isinstance", "(", "chunk", ",", "dict", ")", ":", "continue", "saltenv", "=", "'base'", "crefs", ...
28.407407
0.001261
[ "def lowstate_file_refs(chunks, extras=''):\n", " '''\n", " Create a list of file ref objects to reconcile\n", " '''\n", " refs = {}\n", " for chunk in chunks:\n", " if not isinstance(chunk, dict):\n", " continue\n", " saltenv = 'base'\n", " crefs = [...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.06666666666666667 ]
27
0.002469
def ADDMOD(self, a, b, c): """Modulo addition operation""" try: result = Operators.ITEBV(256, c == 0, 0, (a + b) % c) except ZeroDivisionError: result = 0 return result
[ "def", "ADDMOD", "(", "self", ",", "a", ",", "b", ",", "c", ")", ":", "try", ":", "result", "=", "Operators", ".", "ITEBV", "(", "256", ",", "c", "==", "0", ",", "0", ",", "(", "a", "+", "b", ")", "%", "c", ")", "except", "ZeroDivisionError",...
31.142857
0.008929
[ "def ADDMOD(self, a, b, c):\n", " \"\"\"Modulo addition operation\"\"\"\n", " try:\n", " result = Operators.ITEBV(256, c == 0, 0, (a + b) % c)\n", " except ZeroDivisionError:\n", " result = 0\n", " return result" ]
[ 0, 0.025, 0, 0, 0, 0, 0.047619047619047616 ]
7
0.010374
def _process_dataset(name, directory, num_shards, labels_file): """Process a complete data set and save it as a TFRecord. Args: name: string, unique identifier specifying the data set. directory: string, root path to the data set. num_shards: integer number of shards for this data set. labels_file:...
[ "def", "_process_dataset", "(", "name", ",", "directory", ",", "num_shards", ",", "labels_file", ")", ":", "filenames", ",", "texts", ",", "labels", "=", "_find_image_files", "(", "directory", ",", "labels_file", ")", "_process_image_files", "(", "name", ",", ...
44.272727
0.008048
[ "def _process_dataset(name, directory, num_shards, labels_file):\n", " \"\"\"Process a complete data set and save it as a TFRecord.\n", "\n", " Args:\n", " name: string, unique identifier specifying the data set.\n", " directory: string, root path to the data set.\n", " num_shards: integer nu...
[ 0, 0.016666666666666666, 0, 0, 0, 0, 0, 0, 0, 0.014084507042253521, 0.030303030303030304 ]
11
0.00555
def add_provide(self, provide): """ Add a provide object if it does not already exist """ for p in self.provides: if p.value == provide.value: return self.provides.append(provide)
[ "def", "add_provide", "(", "self", ",", "provide", ")", ":", "for", "p", "in", "self", ".", "provides", ":", "if", "p", ".", "value", "==", "provide", ".", "value", ":", "return", "self", ".", "provides", ".", "append", "(", "provide", ")" ]
37.666667
0.008658
[ "def add_provide(self, provide):\n", " \"\"\" Add a provide object if it does not already exist \"\"\"\n", " for p in self.provides:\n", " if p.value == provide.value:\n", " return\n", " self.provides.append(provide)" ]
[ 0, 0.015151515151515152, 0, 0, 0, 0.02702702702702703 ]
6
0.00703
def _parseHeader (self, line, lineno, log): """Parses a sequence header line containing 'name: value' pairs.""" if line.startswith('#') and line.find(':') > 0: tokens = [ t.strip().lower() for t in line[1:].split(":", 1) ] name = tokens[0] pos = SeqPos(line, lineno) if name in self...
[ "def", "_parseHeader", "(", "self", ",", "line", ",", "lineno", ",", "log", ")", ":", "if", "line", ".", "startswith", "(", "'#'", ")", "and", "line", ".", "find", "(", "':'", ")", ">", "0", ":", "tokens", "=", "[", "t", ".", "strip", "(", ")",...
39.526316
0.019506
[ "def _parseHeader (self, line, lineno, log):\n", " \"\"\"Parses a sequence header line containing 'name: value' pairs.\"\"\"\n", " if line.startswith('#') and line.find(':') > 0:\n", " tokens = [ t.strip().lower() for t in line[1:].split(\":\", 1) ]\n", " name = tokens[0]\n", " pos ...
[ 0.022727272727272728, 0, 0, 0.043478260869565216, 0.08, 0.05555555555555555, 0, 0.03333333333333333, 0, 0, 0.08333333333333333, 0, 0.03225806451612903, 0, 0, 0.015384615384615385, 0.01818181818181818, 0, 0.05128205128205128 ]
19
0.022923
def get_grp2codes(self): """Get dict of group name to namedtuples.""" grp2codes = cx.defaultdict(set) for code, ntd in self.code2nt.items(): grp2codes[ntd.group].add(code) return dict(grp2codes)
[ "def", "get_grp2codes", "(", "self", ")", ":", "grp2codes", "=", "cx", ".", "defaultdict", "(", "set", ")", "for", "code", ",", "ntd", "in", "self", ".", "code2nt", ".", "items", "(", ")", ":", "grp2codes", "[", "ntd", ".", "group", "]", ".", "add"...
38.833333
0.008403
[ "def get_grp2codes(self):\n", " \"\"\"Get dict of group name to namedtuples.\"\"\"\n", " grp2codes = cx.defaultdict(set)\n", " for code, ntd in self.code2nt.items():\n", " grp2codes[ntd.group].add(code)\n", " return dict(grp2codes)" ]
[ 0, 0.018867924528301886, 0, 0, 0, 0.03333333333333333 ]
6
0.0087
def add_bollinger_bands(self,periods=20,boll_std=2,fill=True,column=None,name='', str='{name}({column},{period})',**kwargs): """ Add Bollinger Bands (BOLL) study to QuantFigure.studies Parameters: periods : int or list(int) Number of periods boll_std : int Number of standard deviations for...
[ "def", "add_bollinger_bands", "(", "self", ",", "periods", "=", "20", ",", "boll_std", "=", "2", ",", "fill", "=", "True", ",", "column", "=", "None", ",", "name", "=", "''", ",", "str", "=", "'{name}({column},{period})'", ",", "*", "*", "kwargs", ")",...
29.304348
0.059584
[ "def add_bollinger_bands(self,periods=20,boll_std=2,fill=True,column=None,name='',\n", "\t\t\t\t\t\t str='{name}({column},{period})',**kwargs):\n", "\t\t\"\"\"\n", "\t\tAdd Bollinger Bands (BOLL) study to QuantFigure.studies\n", "\n", "\t\tParameters:\n", "\t\t\tperiods : int or list(int)\n", "\t\t\...
[ 0.07317073170731707, 0.07692307692307693, 0.3333333333333333, 0.017241379310344827, 0, 0.07142857142857142, 0.03333333333333333, 0.045454545454545456, 0.05555555555555555, 0.02631578947368421, 0.025, 0.05555555555555555, 0.047619047619047616, 0.045454545454545456, 0.05555555555555555, ...
46
0.068529
def from_analysis_period(cls, analysis_period, tau_b, tau_d, daylight_savings_indicator='No'): """"Initialize a RevisedClearSkyCondition from an analysis_period""" _check_analysis_period(analysis_period) return cls(analysis_period.st_month, analysis_period.st_day, ta...
[ "def", "from_analysis_period", "(", "cls", ",", "analysis_period", ",", "tau_b", ",", "tau_d", ",", "daylight_savings_indicator", "=", "'No'", ")", ":", "_check_analysis_period", "(", "analysis_period", ")", "return", "cls", "(", "analysis_period", ".", "st_month", ...
62.166667
0.010582
[ "def from_analysis_period(cls, analysis_period, tau_b, tau_d,\n", " daylight_savings_indicator='No'):\n", " \"\"\"\"Initialize a RevisedClearSkyCondition from an analysis_period\"\"\"\n", " _check_analysis_period(analysis_period)\n", " return cls(analysis_per...
[ 0, 0.015873015873015872, 0.012987012987012988, 0, 0.012048192771084338, 0.021739130434782608 ]
6
0.010441
def init_defaults(self): """Initializes important headers to default values, if not already specified. The WARC-Record-ID header is set to a newly generated UUID. The WARC-Date header is set to the current datetime. The Content-Type is set based on the WARC-Type header. ...
[ "def", "init_defaults", "(", "self", ")", ":", "if", "\"WARC-Record-ID\"", "not", "in", "self", ":", "self", "[", "'WARC-Record-ID'", "]", "=", "\"<urn:uuid:%s>\"", "%", "uuid", ".", "uuid1", "(", ")", "if", "\"WARC-Date\"", "not", "in", "self", ":", "self...
52.5
0.008021
[ "def init_defaults(self):\n", " \"\"\"Initializes important headers to default values, if not already specified.\n", " \n", " The WARC-Record-ID header is set to a newly generated UUID.\n", " The WARC-Date header is set to the current datetime.\n", " The Content-Type is ...
[ 0, 0.023255813953488372, 0.1111111111111111, 0, 0, 0, 0, 0, 0, 0, 0, 0.011111111111111112, 0, 0.0196078431372549 ]
14
0.011792
def branches(self): """ #TODO: description """ for branch in self._grid.graph_edges(): if branch['branch'].ring == self: yield branch
[ "def", "branches", "(", "self", ")", ":", "for", "branch", "in", "self", ".", "_grid", ".", "graph_edges", "(", ")", ":", "if", "branch", "[", "'branch'", "]", ".", "ring", "==", "self", ":", "yield", "branch" ]
30
0.010811
[ "def branches(self):\n", " \"\"\" #TODO: description\n", " \"\"\"\n", " for branch in self._grid.graph_edges():\n", " if branch['branch'].ring == self:\n", " yield branch" ]
[ 0, 0.03225806451612903, 0, 0, 0, 0.03571428571428571 ]
6
0.011329
def build_job(name=None, parameters=None): ''' Initiate a build for the provided job. :param name: The name of the job is check if it exists. :param parameters: Parameters to send to the job. :return: True is successful, otherwise raise an exception. CLI Example: .. code-block:: bash ...
[ "def", "build_job", "(", "name", "=", "None", ",", "parameters", "=", "None", ")", ":", "if", "not", "name", ":", "raise", "SaltInvocationError", "(", "'Required parameter \\'name\\' is missing'", ")", "server", "=", "_connect", "(", ")", "if", "not", "job_exi...
26.766667
0.001202
[ "def build_job(name=None, parameters=None):\n", " '''\n", " Initiate a build for the provided job.\n", "\n", " :param name: The name of the job is check if it exists.\n", " :param parameters: Parameters to send to the job.\n", " :return: True is successful, otherwise raise an exception.\n...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.06666666666666667 ]
30
0.002222
def sca_intensity(scatterer, h_pol=True): """Scattering intensity (phase function) for the current setup. Args: scatterer: a Scatterer instance. h_pol: If True (default), use horizontal polarization. If False, use vertical polarization. Returns: The differential scatter...
[ "def", "sca_intensity", "(", "scatterer", ",", "h_pol", "=", "True", ")", ":", "Z", "=", "scatterer", ".", "get_Z", "(", ")", "return", "(", "Z", "[", "0", ",", "0", "]", "-", "Z", "[", "0", ",", "1", "]", ")", "if", "h_pol", "else", "(", "Z"...
32.384615
0.013857
[ "def sca_intensity(scatterer, h_pol=True):\n", " \"\"\"Scattering intensity (phase function) for the current setup. \n", "\n", " Args:\n", " scatterer: a Scatterer instance.\n", " h_pol: If True (default), use horizontal polarization.\n", " If False, use vertical polarizati...
[ 0, 0.013888888888888888, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.08333333333333333 ]
13
0.007479
def _instantiate_target(self, target_adaptor): """Given a TargetAdaptor struct previously parsed from a BUILD file, instantiate a Target.""" target_cls = self._target_types[target_adaptor.type_alias] try: # Pop dependencies, which were already consumed during construction. kwargs = target_adapto...
[ "def", "_instantiate_target", "(", "self", ",", "target_adaptor", ")", ":", "target_cls", "=", "self", ".", "_target_types", "[", "target_adaptor", ".", "type_alias", "]", "try", ":", "# Pop dependencies, which were already consumed during construction.", "kwargs", "=", ...
42.2
0.013905
[ "def _instantiate_target(self, target_adaptor):\n", " \"\"\"Given a TargetAdaptor struct previously parsed from a BUILD file, instantiate a Target.\"\"\"\n", " target_cls = self._target_types[target_adaptor.type_alias]\n", " try:\n", " # Pop dependencies, which were already consumed during con...
[ 0, 0.01020408163265306, 0, 0, 0.013333333333333334, 0.02564102564102564, 0.030303030303030304, 0, 0.047619047619047616, 0.023809523809523808, 0, 0.025, 0, 0.019230769230769232, 0, 0.08333333333333333, 0, 0.02564102564102564, 0, 0.025 ]
20
0.016456
def nnz_obs_names(self): """ wrapper around pyemu.Pst.nnz_obs_names for listing non-zero observation names Returns ------- nnz_obs_names : list pyemu.Pst.nnz_obs_names """ if self.__pst is not None: return self.pst.nnz_obs_names ...
[ "def", "nnz_obs_names", "(", "self", ")", ":", "if", "self", ".", "__pst", "is", "not", "None", ":", "return", "self", ".", "pst", ".", "nnz_obs_names", "else", ":", "return", "self", ".", "jco", ".", "obs_names" ]
25.5
0.008108
[ "def nnz_obs_names(self):\n", " \"\"\" wrapper around pyemu.Pst.nnz_obs_names for listing non-zero\n", " observation names\n", "\n", " Returns\n", " -------\n", " nnz_obs_names : list\n", " pyemu.Pst.nnz_obs_names\n", " \n", " \"\"\"\n", ...
[ 0, 0.013888888888888888, 0, 0, 0, 0, 0, 0, 0.1111111111111111, 0, 0, 0, 0, 0.02702702702702703 ]
14
0.010859
def _pre_request(self, url, method = u"get", data = None, headers=None, **kwargs): """ hook for manipulating the _pre request data """ return (url, method, data, headers, kwargs)
[ "def", "_pre_request", "(", "self", ",", "url", ",", "method", "=", "u\"get\"", ",", "data", "=", "None", ",", "headers", "=", "None", ",", "*", "*", "kwargs", ")", ":", "return", "(", "url", ",", "method", ",", "data", ",", "headers", ",", "kwargs...
41.2
0.033333
[ "def _pre_request(self, url, method = u\"get\", data = None, headers=None, **kwargs):\n", " \"\"\"\n", " hook for manipulating the _pre request data\n", " \"\"\"\n", " return (url, method, data, headers, kwargs)" ]
[ 0.060240963855421686, 0.08333333333333333, 0, 0, 0.0196078431372549 ]
5
0.032636
def _gpdfit(x): """Estimate the parameters for the Generalized Pareto Distribution (GPD). Empirical Bayes estimate for the parameters of the generalized Pareto distribution given the data. Parameters ---------- x : array sorted 1D data array Returns ------- k : float ...
[ "def", "_gpdfit", "(", "x", ")", ":", "prior_bs", "=", "3", "prior_k", "=", "10", "len_x", "=", "len", "(", "x", ")", "m_est", "=", "30", "+", "int", "(", "len_x", "**", "0.5", ")", "b_ary", "=", "1", "-", "np", ".", "sqrt", "(", "m_est", "/"...
28.958333
0.002088
[ "def _gpdfit(x):\n", " \"\"\"Estimate the parameters for the Generalized Pareto Distribution (GPD).\n", "\n", " Empirical Bayes estimate for the parameters of the generalized Pareto\n", " distribution given the data.\n", "\n", " Parameters\n", " ----------\n", " x : array\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011904761904761904, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.01020408163265306, 0, 0, 0, 0, 0.041666666666666664 ]
48
0.001329
def get_conn(self): """Returns a Google Cloud Dataproc service object.""" http_authorized = self._authorize() return build( 'dataproc', self.api_version, http=http_authorized, cache_discovery=False)
[ "def", "get_conn", "(", "self", ")", ":", "http_authorized", "=", "self", ".", "_authorize", "(", ")", "return", "build", "(", "'dataproc'", ",", "self", ".", "api_version", ",", "http", "=", "http_authorized", ",", "cache_discovery", "=", "False", ")" ]
40.166667
0.00813
[ "def get_conn(self):\n", " \"\"\"Returns a Google Cloud Dataproc service object.\"\"\"\n", " http_authorized = self._authorize()\n", " return build(\n", " 'dataproc', self.api_version, http=http_authorized,\n", " cache_discovery=False)" ]
[ 0, 0.016129032258064516, 0, 0, 0, 0.029411764705882353 ]
6
0.00759
def create_logger(name, formatter=None, handler=None, level=None): """ Returns a new logger for the specified name. """ logger = logging.getLogger(name) #: remove existing handlers logger.handlers = [] #: use a standard out handler if handler is None: handler = logging.StreamHa...
[ "def", "create_logger", "(", "name", ",", "formatter", "=", "None", ",", "handler", "=", "None", ",", "level", "=", "None", ")", ":", "logger", "=", "logging", ".", "getLogger", "(", "name", ")", "#: remove existing handlers", "logger", ".", "handlers", "=...
25.64
0.001504
[ "def create_logger(name, formatter=None, handler=None, level=None):\n", " \"\"\"\n", " Returns a new logger for the specified name.\n", " \"\"\"\n", " logger = logging.getLogger(name)\n", "\n", " #: remove existing handlers\n", " logger.handlers = []\n", "\n", " #: use a stand...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.058823529411764705 ]
25
0.002353
def get_row_by_fsid(self, fs_id): '''确认在Liststore中是否存在这条任务. 如果存在, 返回TreeModelRow, 否则就返回None''' for row in self.liststore: if row[FSID_COL] == fs_id: return row return None
[ "def", "get_row_by_fsid", "(", "self", ",", "fs_id", ")", ":", "for", "row", "in", "self", ".", "liststore", ":", "if", "row", "[", "FSID_COL", "]", "==", "fs_id", ":", "return", "row", "return", "None" ]
32.142857
0.008658
[ "def get_row_by_fsid(self, fs_id):\n", " '''确认在Liststore中是否存在这条任务. 如果存在, 返回TreeModelRow,\n", " 否则就返回None'''\n", " for row in self.liststore:\n", " if row[FSID_COL] == fs_id:\n", " return row\n", " return None" ]
[ 0, 0.017857142857142856, 0, 0, 0, 0, 0.05263157894736842 ]
7
0.01007
def register_preprocessed_file(self, infile, pmid, extra_annotations): """Set up already preprocessed text file for reading with ISI reader. This is essentially a mock function to "register" already preprocessed files and get an IsiPreprocessor object that can be passed to the IsiProces...
[ "def", "register_preprocessed_file", "(", "self", ",", "infile", ",", "pmid", ",", "extra_annotations", ")", ":", "infile_base", "=", "os", ".", "path", ".", "basename", "(", "infile", ")", "outfile", "=", "os", ".", "path", ".", "join", "(", "self", "."...
40.444444
0.001789
[ "def register_preprocessed_file(self, infile, pmid, extra_annotations):\n", " \"\"\"Set up already preprocessed text file for reading with ISI reader.\n", "\n", " This is essentially a mock function to \"register\" already preprocessed\n", " files and get an IsiPreprocessor object that ...
[ 0, 0.01282051282051282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.016129032258064516 ]
27
0.001072
def serialize_to_xml(root, block): """ Serialize the Peer Instruction XBlock's content to XML. Args: block (PeerInstructionXBlock): The peer instruction block to serialize. root (etree.Element): The XML root node to update. Returns: etree.Element """ root.tag = 'ubcpi'...
[ "def", "serialize_to_xml", "(", "root", ",", "block", ")", ":", "root", ".", "tag", "=", "'ubcpi'", "if", "block", ".", "rationale_size", "is", "not", "None", ":", "if", "block", ".", "rationale_size", ".", "get", "(", "'min'", ")", ":", "root", ".", ...
33.153846
0.002254
[ "def serialize_to_xml(root, block):\n", " \"\"\"\n", " Serialize the Peer Instruction XBlock's content to XML.\n", "\n", " Args:\n", " block (PeerInstructionXBlock): The peer instruction block to serialize.\n", " root (etree.Element): The XML root node to update.\n", "\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011764705882352941, 0, 0.012345679012345678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.030303030303030304 ]
39
0.001395
def make_name(super_name, default_super_name, sub_name): """Helper which makes a `str` name; useful for tf.compat.v1.name_scope.""" name = super_name if super_name is not None else default_super_name if sub_name is not None: name += '_' + sub_name return name
[ "def", "make_name", "(", "super_name", ",", "default_super_name", ",", "sub_name", ")", ":", "name", "=", "super_name", "if", "super_name", "is", "not", "None", "else", "default_super_name", "if", "sub_name", "is", "not", "None", ":", "name", "+=", "'_'", "+...
44.333333
0.01845
[ "def make_name(super_name, default_super_name, sub_name):\n", " \"\"\"Helper which makes a `str` name; useful for tf.compat.v1.name_scope.\"\"\"\n", " name = super_name if super_name is not None else default_super_name\n", " if sub_name is not None:\n", " name += '_' + sub_name\n", " return name" ]
[ 0, 0.012987012987012988, 0.014285714285714285, 0.037037037037037035, 0, 0.15384615384615385 ]
6
0.036359
def getCenter(self): """ Return the ``Location`` of the center of this region """ return Location(self.x+(self.w/2), self.y+(self.h/2))
[ "def", "getCenter", "(", "self", ")", ":", "return", "Location", "(", "self", ".", "x", "+", "(", "self", ".", "w", "/", "2", ")", ",", "self", ".", "y", "+", "(", "self", ".", "h", "/", "2", ")", ")" ]
49.666667
0.013245
[ "def getCenter(self):\n", " \"\"\" Return the ``Location`` of the center of this region \"\"\"\n", " return Location(self.x+(self.w/2), self.y+(self.h/2))" ]
[ 0, 0.014492753623188406, 0.01639344262295082 ]
3
0.010295
def decode(token, certs=None, verify=True, audience=None): """Decode and verify a JWT. Args: token (str): The encoded JWT. certs (Union[str, bytes, Mapping[str, Union[str, bytes]]]): The certificate used to validate the JWT signature. If bytes or string, it must the the ...
[ "def", "decode", "(", "token", ",", "certs", "=", "None", ",", "verify", "=", "True", ",", "audience", "=", "None", ")", ":", "header", ",", "payload", ",", "signed_section", ",", "signature", "=", "_unverified_decode", "(", "token", ")", "if", "not", ...
38.896552
0.000432
[ "def decode(token, certs=None, verify=True, audience=None):\n", " \"\"\"Decode and verify a JWT.\n", "\n", " Args:\n", " token (str): The encoded JWT.\n", " certs (Union[str, bytes, Mapping[str, Union[str, bytes]]]): The\n", " certificate used to validate the JWT signature...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05555555555555555 ]
58
0.000958
def logscale(x_min, x_max, n): """ :param x_min: minumum value :param x_max: maximum value :param n: number of steps :returns: an array of n values from x_min to x_max """ if not (isinstance(n, int) and n > 0): raise ValueError('n must be a positive integer, got %s' % n) if x_min...
[ "def", "logscale", "(", "x_min", ",", "x_max", ",", "n", ")", ":", "if", "not", "(", "isinstance", "(", "n", ",", "int", ")", "and", "n", ">", "0", ")", ":", "raise", "ValueError", "(", "'n must be a positive integer, got %s'", "%", "n", ")", "if", "...
38.375
0.00159
[ "def logscale(x_min, x_max, n):\n", " \"\"\"\n", " :param x_min: minumum value\n", " :param x_max: maximum value\n", " :param n: number of steps\n", " :returns: an array of n values from x_min to x_max\n", " \"\"\"\n", " if not (isinstance(n, int) and n > 0):\n", " raise ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015873015873015872 ]
16
0.000992
def _outer_error_is_decreasing(self): """True if outer iteration error is decreasing.""" is_decreasing, self._last_outer_error = self._error_is_decreasing(self._last_outer_error) return is_decreasing
[ "def", "_outer_error_is_decreasing", "(", "self", ")", ":", "is_decreasing", ",", "self", ".", "_last_outer_error", "=", "self", ".", "_error_is_decreasing", "(", "self", ".", "_last_outer_error", ")", "return", "is_decreasing" ]
55
0.013453
[ "def _outer_error_is_decreasing(self):\n", " \"\"\"True if outer iteration error is decreasing.\"\"\"\n", " is_decreasing, self._last_outer_error = self._error_is_decreasing(self._last_outer_error)\n", " return is_decreasing" ]
[ 0, 0.01694915254237288, 0.01020408163265306, 0.03571428571428571 ]
4
0.015717
def _getshapes_2d(center, max_radius, shape): """Calculate indices and slices for the bounding box of a disk.""" index_mean = shape * center index_radius = max_radius / 2.0 * np.array(shape) # Avoid negative indices min_idx = np.maximum(np.floor(index_mean - index_radius), 0).astype(int) max_id...
[ "def", "_getshapes_2d", "(", "center", ",", "max_radius", ",", "shape", ")", ":", "index_mean", "=", "shape", "*", "center", "index_radius", "=", "max_radius", "/", "2.0", "*", "np", ".", "array", "(", "shape", ")", "# Avoid negative indices", "min_idx", "="...
45
0.001815
[ "def _getshapes_2d(center, max_radius, shape):\n", " \"\"\"Calculate indices and slices for the bounding box of a disk.\"\"\"\n", " index_mean = shape * center\n", " index_radius = max_radius / 2.0 * np.array(shape)\n", "\n", " # Avoid negative indices\n", " min_idx = np.maximum(np.floor(...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.027777777777777776 ]
12
0.002315
def _get_queue_for_the_action(self, action): """Find action queue for the action depending on the module. The id is found with action modulo on action id :param a: the action that need action queue to be assigned :type action: object :return: worker id and queue. (0, None) if no...
[ "def", "_get_queue_for_the_action", "(", "self", ",", "action", ")", ":", "# get the module name, if not, take fork", "mod", "=", "getattr", "(", "action", ",", "'module_type'", ",", "'fork'", ")", "queues", "=", "list", "(", "self", ".", "q_by_mod", "[", "mod",...
38
0.002139
[ "def _get_queue_for_the_action(self, action):\n", " \"\"\"Find action queue for the action depending on the module.\n", " The id is found with action modulo on action id\n", "\n", " :param a: the action that need action queue to be assigned\n", " :type action: object\n", " ...
[ 0, 0.014492753623188406, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.030303030303030304 ]
24
0.001866
def dict_from_cookiejar(cj): """Returns a key/value dictionary from a CookieJar. :param cj: CookieJar object to extract cookies from. """ cookie_dict = {} for _, cookies in cj._cookies.items(): for _, cookies in cookies.items(): for cookie in cookies.values(): ...
[ "def", "dict_from_cookiejar", "(", "cj", ")", ":", "cookie_dict", "=", "{", "}", "for", "_", ",", "cookies", "in", "cj", ".", "_cookies", ".", "items", "(", ")", ":", "for", "_", ",", "cookies", "in", "cookies", ".", "items", "(", ")", ":", "for", ...
26.666667
0.002415
[ "def dict_from_cookiejar(cj):\n", " \"\"\"Returns a key/value dictionary from a CookieJar.\n", "\n", " :param cj: CookieJar object to extract cookies from.\n", " \"\"\"\n", "\n", " cookie_dict = {}\n", "\n", " for _, cookies in cj._cookies.items():\n", " for _, cookies in coo...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.045454545454545456 ]
15
0.00303
def rgb(red, green, blue, content): """ Colors a content using rgb for h :param red: [0-5] :type red: int :param green: [0-5] :type green: int :param blue: [0-5] :type blue: int :param content: Whatever you want to say... :type content: unicode :return: ansi string :rtype: un...
[ "def", "rgb", "(", "red", ",", "green", ",", "blue", ",", "content", ")", ":", "color", "=", "16", "+", "36", "*", "red", "+", "6", "*", "green", "+", "blue", "return", "encode", "(", "'38;5;'", "+", "str", "(", "color", ")", ")", "+", "content...
28.8
0.002242
[ "def rgb(red, green, blue, content):\n", " \"\"\" Colors a content using rgb for h\n", " :param red: [0-5]\n", " :type red: int\n", " :param green: [0-5]\n", " :type green: int\n", " :param blue: [0-5]\n", " :type blue: int\n", " :param content: Whatever you want to say...\n"...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.014925373134328358 ]
15
0.000995
def get_polygons(self, by_spec=False, depth=None): """ Returns a list of polygons in this cell. Parameters ---------- by_spec : bool If ``True``, the return value is a dictionary with the polygons of each individual pair (layer, datatype). depth :...
[ "def", "get_polygons", "(", "self", ",", "by_spec", "=", "False", ",", "depth", "=", "None", ")", ":", "if", "depth", "is", "not", "None", "and", "depth", "<", "0", ":", "bb", "=", "self", ".", "get_bounding_box", "(", ")", "if", "bb", "is", "None"...
43.625
0.000701
[ "def get_polygons(self, by_spec=False, depth=None):\n", " \"\"\"\n", " Returns a list of polygons in this cell.\n", "\n", " Parameters\n", " ----------\n", " by_spec : bool\n", " If ``True``, the return value is a dictionary with the\n", " pol...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
64
0.001981
def assemble(self): """Assemble a QasmQobjInstruction""" instruction = super().assemble() if self.label: instruction.label = self.label return instruction
[ "def", "assemble", "(", "self", ")", ":", "instruction", "=", "super", "(", ")", ".", "assemble", "(", ")", "if", "self", ".", "label", ":", "instruction", ".", "label", "=", "self", ".", "label", "return", "instruction" ]
32.166667
0.010101
[ "def assemble(self):\n", " \"\"\"Assemble a QasmQobjInstruction\"\"\"\n", " instruction = super().assemble()\n", " if self.label:\n", " instruction.label = self.label\n", " return instruction" ]
[ 0, 0.022222222222222223, 0, 0, 0, 0.038461538461538464 ]
6
0.010114
def longest_monotonic_subseq_length(xs): '''Return the length of the longest monotonic subsequence of xs, second return value is the difference between increasing and decreasing lengths. >>> longest_monotonic_subseq_length((4, 5, 1, 2, 3)) (3, 1) >>> longest_monotonic_subseq_length((1, 2, 3, 5, 4))...
[ "def", "longest_monotonic_subseq_length", "(", "xs", ")", ":", "li", "=", "longest_increasing_subseq_length", "(", "xs", ")", "ld", "=", "longest_decreasing_subseq_length", "(", "xs", ")", "return", "max", "(", "li", ",", "ld", ")", ",", "li", "-", "ld" ]
36.571429
0.001905
[ "def longest_monotonic_subseq_length(xs):\n", " '''Return the length of the longest monotonic subsequence of xs, second\n", " return value is the difference between increasing and decreasing lengths.\n", "\n", " >>> longest_monotonic_subseq_length((4, 5, 1, 2, 3))\n", " (3, 1)\n", " >>> l...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03225806451612903 ]
14
0.002304
def docker_to_uuid(uuid): ''' Get the image uuid from an imported docker image .. versionadded:: 2019.2.0 ''' if _is_uuid(uuid): return uuid if _is_docker_uuid(uuid): images = list_installed(verbose=True) for image_uuid in images: if 'name' not in images[imag...
[ "def", "docker_to_uuid", "(", "uuid", ")", ":", "if", "_is_uuid", "(", "uuid", ")", ":", "return", "uuid", "if", "_is_docker_uuid", "(", "uuid", ")", ":", "images", "=", "list_installed", "(", "verbose", "=", "True", ")", "for", "image_uuid", "in", "imag...
27.4375
0.002203
[ "def docker_to_uuid(uuid):\n", " '''\n", " Get the image uuid from an imported docker image\n", "\n", " .. versionadded:: 2019.2.0\n", " '''\n", " if _is_uuid(uuid):\n", " return uuid\n", " if _is_docker_uuid(uuid):\n", " images = list_installed(verbose=True)\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.06666666666666667 ]
16
0.004167
def tplot_options(option, value): """ This function allows the user to set several global options for the generated plots. Parameters: option : str The name of the option. See section below value : str/int/float/list The value of the option. See section bel...
[ "def", "tplot_options", "(", "option", ",", "value", ")", ":", "option", "=", "option", ".", "lower", "(", ")", "temp", "=", "tplot_utilities", ".", "set_tplot_options", "(", "option", ",", "value", ",", "pytplot", ".", "tplot_opt_glob", ")", "pytplot", "....
40.12
0.015085
[ "def tplot_options(option, value):\n", " \"\"\"\n", " This function allows the user to set several global options for the generated plots. \n", " \n", " Parameters:\n", " option : str\n", " The name of the option. See section below \n", " value : str/int/float/l...
[ 0, 0, 0.02197802197802198, 0.2, 0, 0, 0.017543859649122806, 0, 0.01694915254237288, 0.07692307692307693, 0, 0, 0, 0, 0, 0.016666666666666666, 0.012195121951219513, 0.012987012987012988, 0.01098901098901099, 0.01098901098901099, 0.010869565217391304, 0.01098901098901099, 0...
50
0.049153
def stripe_to_db(self, data): """Convert the raw timestamp value to a DateTime representation.""" val = data.get(self.name) # Note: 0 is a possible return value, which is 'falseish' if val is not None: return convert_tstamp(val)
[ "def", "stripe_to_db", "(", "self", ",", "data", ")", ":", "val", "=", "data", ".", "get", "(", "self", ".", "name", ")", "# Note: 0 is a possible return value, which is 'falseish'", "if", "val", "is", "not", "None", ":", "return", "convert_tstamp", "(", "val"...
33.428571
0.029167
[ "def stripe_to_db(self, data):\n", "\t\t\"\"\"Convert the raw timestamp value to a DateTime representation.\"\"\"\n", "\t\tval = data.get(self.name)\n", "\n", "\t\t# Note: 0 is a possible return value, which is 'falseish'\n", "\t\tif val is not None:\n", "\t\t\treturn convert_tstamp(val)" ]
[ 0, 0.02857142857142857, 0.03571428571428571, 0, 0.016666666666666666, 0.045454545454545456, 0.06896551724137931 ]
7
0.02791
def update_limits(self, change_source_lower_limit=None, change_source_upper_limit=None): """ updates the limits (lower and upper) of the update manager instance :param change_source_lower_limit: [[i_model, ['param_name', ...], [value1, value2, ...]]] :return: updates internal state of l...
[ "def", "update_limits", "(", "self", ",", "change_source_lower_limit", "=", "None", ",", "change_source_upper_limit", "=", "None", ")", ":", "if", "not", "change_source_lower_limit", "is", "None", ":", "self", ".", "_source_lower", "=", "self", ".", "_update_limit...
60.454545
0.013333
[ "def update_limits(self, change_source_lower_limit=None, change_source_upper_limit=None):\n", " \"\"\"\n", " updates the limits (lower and upper) of the update manager instance\n", "\n", " :param change_source_lower_limit: [[i_model, ['param_name', ...], [value1, value2, ...]]]\n", " ...
[ 0.011235955056179775, 0.08333333333333333, 0, 0, 0.01020408163265306, 0.011111111111111112, 0, 0.02, 0.010101010101010102, 0.02, 0.02040816326530612 ]
11
0.016945
def validate_capacity(capacity): """Validate ScalingConfiguration capacity for serverless DBCluster""" if capacity not in VALID_SCALING_CONFIGURATION_CAPACITIES: raise ValueError( "ScalingConfiguration capacity must be one of: {}".format( ", ".join(map( s...
[ "def", "validate_capacity", "(", "capacity", ")", ":", "if", "capacity", "not", "in", "VALID_SCALING_CONFIGURATION_CAPACITIES", ":", "raise", "ValueError", "(", "\"ScalingConfiguration capacity must be one of: {}\"", ".", "format", "(", "\", \"", ".", "join", "(", "map"...
33.307692
0.002247
[ "def validate_capacity(capacity):\n", " \"\"\"Validate ScalingConfiguration capacity for serverless DBCluster\"\"\"\n", "\n", " if capacity not in VALID_SCALING_CONFIGURATION_CAPACITIES:\n", " raise ValueError(\n", " \"ScalingConfiguration capacity must be one of: {}\".format(\n", ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05263157894736842 ]
13
0.004049
def project_status(): """...""" r = Response() try: project = cauldron.project.get_internal_project() if project: r.update(project=project.status()) else: r.update(project=None) except Exception as err: r.fail( code='PROJECT_STATUS_ERR...
[ "def", "project_status", "(", ")", ":", "r", "=", "Response", "(", ")", "try", ":", "project", "=", "cauldron", ".", "project", ".", "get_internal_project", "(", ")", "if", "project", ":", "r", ".", "update", "(", "project", "=", "project", ".", "statu...
26.631579
0.001908
[ "def project_status():\n", " \"\"\"...\"\"\"\n", " r = Response()\n", "\n", " try:\n", " project = cauldron.project.get_internal_project()\n", " if project:\n", " r.update(project=project.status())\n", " else:\n", " r.update(project=None)\n", "...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.02564102564102564 ]
19
0.00135
def addai(argname, condition=None): r""" Add an "AI" exception in the global exception handler. An "AI" exception is of the type :code:`RuntimeError('Argument \`*[argname]*\` is not valid')` where :code:`*[argname]*` is the value of the **argname** argument :param argname: Argument name :t...
[ "def", "addai", "(", "argname", ",", "condition", "=", "None", ")", ":", "# pylint: disable=C0123", "if", "not", "isinstance", "(", "argname", ",", "str", ")", ":", "raise", "RuntimeError", "(", "\"Argument `argname` is not valid\"", ")", "if", "(", "condition",...
37
0.001756
[ "def addai(argname, condition=None):\n", " r\"\"\"\n", " Add an \"AI\" exception in the global exception handler.\n", "\n", " An \"AI\" exception is of the type :code:`RuntimeError('Argument\n", " \\`*[argname]*\\` is not valid')` where :code:`*[argname]*` is the value of\n", " the **argn...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011235955056179775, 0.047619047619047616 ]
30
0.001962
def spawn(func, *args, **kwargs): """Create a task to run ``func(*args, **kwargs)``. Returns a :class:`Task` objec. Execution control returns immediately to the caller; the created task is merely scheduled to be run at the next available opportunity. Use :func:`spawn_later` to arrange for tasks t...
[ "def", "spawn", "(", "func", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "t", "=", "Task", "(", "target", "=", "func", ",", "args", "=", "args", ",", "kwargs", "=", "kwargs", ")", "t", ".", "start", "(", ")", "return", "t" ]
36.166667
0.002247
[ "def spawn(func, *args, **kwargs):\n", " \"\"\"Create a task to run ``func(*args, **kwargs)``. Returns a\n", " :class:`Task` objec.\n", "\n", " Execution control returns immediately to the caller; the created task\n", " is merely scheduled to be run at the next available opportunity.\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.08333333333333333 ]
12
0.006944
def get_overlapping_ranges(self, collection_link, partition_key_ranges): ''' Given a partition key range and a collection, returns the list of overlapping partition key ranges :param str collection_link: The name of the collection. :param list partition_key_...
[ "def", "get_overlapping_ranges", "(", "self", ",", "collection_link", ",", "partition_key_ranges", ")", ":", "cl", "=", "self", ".", "_documentClient", "collection_id", "=", "base", ".", "GetResourceIdOrFullNameFromLink", "(", "collection_link", ")", "collection_routing...
54.321429
0.011628
[ "def get_overlapping_ranges(self, collection_link, partition_key_ranges):\n", " '''\n", " Given a partition key range and a collection, \n", " returns the list of overlapping partition key ranges\n", " \n", " :param str collection_link:\n", " The name of the...
[ 0, 0.08333333333333333, 0.01818181818181818, 0, 0.1111111111111111, 0, 0, 0.023809523809523808, 0, 0.1111111111111111, 0, 0, 0, 0, 0, 0.1111111111111111, 0, 0.1111111111111111, 0.011235955056179775, 0, 0.011764705882352941, 0.01680672268907563, 0.017094017094017096, 0, ...
28
0.024259
def list_config_map_for_all_namespaces(self, **kwargs): """ list or watch objects of kind ConfigMap This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True >>> thread = api.list_config_map_for_all_namespaces(async_...
[ "def", "list_config_map_for_all_namespaces", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "[", "'_return_http_data_only'", "]", "=", "True", "if", "kwargs", ".", "get", "(", "'async_req'", ")", ":", "return", "self", ".", "list_config_map_for_all_na...
168.777778
0.0024
[ "def list_config_map_for_all_namespaces(self, **kwargs):\n", " \"\"\"\n", " list or watch objects of kind ConfigMap\n", " This method makes a synchronous HTTP request by default. To make an\n", " asynchronous HTTP request, please pass async_req=True\n", " >>> thread = ap...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0.0007961783439490446, 0.0078125, 0.0078125, 0.0007189072609633358, 0, 0.002183406113537118, 0.006711409395973154, 0.005988023952095809, 0, 0, 0, 0, 0, 0, 0.011904761904761904, 0, 0.011627906976744186, 0.043478260869565...
27
0.006754
def protocols(self): """ :rtype: dict[int, list of ProtocolAnalyzer] """ if self.__protocols is None: self.__protocols = self.proto_tree_model.protocols return self.__protocols
[ "def", "protocols", "(", "self", ")", ":", "if", "self", ".", "__protocols", "is", "None", ":", "self", ".", "__protocols", "=", "self", ".", "proto_tree_model", ".", "protocols", "return", "self", ".", "__protocols" ]
31.714286
0.008772
[ "def protocols(self):\n", " \"\"\"\n", " :rtype: dict[int, list of ProtocolAnalyzer]\n", " \"\"\"\n", " if self.__protocols is None:\n", " self.__protocols = self.proto_tree_model.protocols\n", " return self.__protocols" ]
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0.03225806451612903 ]
7
0.016513
def local_manager_gid(self): """Group id of local manager group of current authenticated member. Currently a user can be assigned only to one local manager group. If more than one local manager group is configured, an error is raised. """ config = self.root['settings']['ugm_loca...
[ "def", "local_manager_gid", "(", "self", ")", ":", "config", "=", "self", ".", "root", "[", "'settings'", "]", "[", "'ugm_localmanager'", "]", ".", "attrs", "user", "=", "security", ".", "authenticated_user", "(", "get_current_request", "(", ")", ")", "if", ...
41.461538
0.001813
[ "def local_manager_gid(self):\n", " \"\"\"Group id of local manager group of current authenticated member.\n", "\n", " Currently a user can be assigned only to one local manager group. If\n", " more than one local manager group is configured, an error is raised.\n", " \"\"\"\n"...
[ 0, 0.013157894736842105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.038461538461538464 ]
26
0.001985
def layout(self): """Call to have the view layout itself. Subclasses should invoke this after laying out child views and/or updating its own frame. """ if self.shadowed: shadow_size = theme.current.shadow_size shadowed_frame_size = (self.frame.w + shadow_...
[ "def", "layout", "(", "self", ")", ":", "if", "self", ".", "shadowed", ":", "shadow_size", "=", "theme", ".", "current", ".", "shadow_size", "shadowed_frame_size", "=", "(", "self", ".", "frame", ".", "w", "+", "shadow_size", ",", "self", ".", "frame", ...
44.444444
0.002448
[ "def layout(self):\n", " \"\"\"Call to have the view layout itself.\n", "\n", " Subclasses should invoke this after laying out child\n", " views and/or updating its own frame.\n", " \"\"\"\n", " if self.shadowed:\n", " shadow_size = theme.current.shadow_si...
[ 0, 0.020833333333333332, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.027777777777777776 ]
18
0.002701
def ui_label(self): """UI string identifying the partition if possible.""" return ': '.join(filter(None, [ self.ui_device_presentation, self.ui_id_label or self.ui_id_uuid or self.drive_label ]))
[ "def", "ui_label", "(", "self", ")", ":", "return", "': '", ".", "join", "(", "filter", "(", "None", ",", "[", "self", ".", "ui_device_presentation", ",", "self", ".", "ui_id_label", "or", "self", ".", "ui_id_uuid", "or", "self", ".", "drive_label", "]",...
39.666667
0.00823
[ "def ui_label(self):\n", " \"\"\"UI string identifying the partition if possible.\"\"\"\n", " return ': '.join(filter(None, [\n", " self.ui_device_presentation,\n", " self.ui_id_label or self.ui_id_uuid or self.drive_label\n", " ]))" ]
[ 0, 0.015873015873015872, 0, 0, 0, 0.09090909090909091 ]
6
0.017797
def get_value(self, dictionary): """ Given the *incoming* primitive data, return the value for this field that should be validated and transformed to a native value. """ if html.is_html_input(dictionary): # HTML forms will represent empty fields as '', and cannot ...
[ "def", "get_value", "(", "self", ",", "dictionary", ")", ":", "if", "html", ".", "is_html_input", "(", "dictionary", ")", ":", "# HTML forms will represent empty fields as '', and cannot", "# represent None or False values directly.", "if", "self", ".", "field_name", "not...
50.826087
0.001679
[ "def get_value(self, dictionary):\n", " \"\"\"\n", " Given the *incoming* primitive data, return the value for this field\n", " that should be validated and transformed to a native value.\n", " \"\"\"\n", " if html.is_html_input(dictionary):\n", " # HTML for...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.018867924528301886 ]
23
0.004444
def user(name, id='', user='', priv='', password='', status='active'): ''' Ensures that a user is configured on the device. Due to being unable to verify the user password. This is a forced operation. .. versionadded:: 2019.2.0 name: The name of the module function to execute. id(int): The us...
[ "def", "user", "(", "name", ",", "id", "=", "''", ",", "user", "=", "''", ",", "priv", "=", "''", ",", "password", "=", "''", ",", "status", "=", "'active'", ")", ":", "ret", "=", "_default_ret", "(", "name", ")", "user_conf", "=", "__salt__", "[...
26.149254
0.00165
[ "def user(name, id='', user='', priv='', password='', status='active'):\n", " '''\n", " Ensures that a user is configured on the device. Due to being unable to\n", " verify the user password. This is a forced operation.\n", "\n", " .. versionadded:: 2019.2.0\n", "\n", " name: The name o...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.00980392156862745, 0, 0, 0.012048192771084338, 0, 0, 0, 0, 0, 0, 0, 0, ...
67
0.001392
def get_account_tokens(self, address): """ Get the list of tokens that this address owns """ cur = self.db.cursor() return namedb_get_account_tokens(cur, address)
[ "def", "get_account_tokens", "(", "self", ",", "address", ")", ":", "cur", "=", "self", ".", "db", ".", "cursor", "(", ")", "return", "namedb_get_account_tokens", "(", "cur", ",", "address", ")" ]
32.833333
0.009901
[ "def get_account_tokens(self, address):\n", " \"\"\"\n", " Get the list of tokens that this address owns\n", " \"\"\"\n", " cur = self.db.cursor()\n", " return namedb_get_account_tokens(cur, address)" ]
[ 0, 0.08333333333333333, 0, 0, 0, 0.018518518518518517 ]
6
0.016975
def toJSONFilters(actions): """Generate a JSON-to-JSON filter from stdin to stdout The filter: * reads a JSON-formatted pandoc document from stdin * transforms it by walking the tree and performing the actions * returns a new JSON-formatted pandoc document to stdout The argument `actions` is ...
[ "def", "toJSONFilters", "(", "actions", ")", ":", "try", ":", "input_stream", "=", "io", ".", "TextIOWrapper", "(", "sys", ".", "stdin", ".", "buffer", ",", "encoding", "=", "'utf-8'", ")", "except", "AttributeError", ":", "# Python 2 does not have sys.stdin.buf...
34.21875
0.000888
[ "def toJSONFilters(actions):\n", " \"\"\"Generate a JSON-to-JSON filter from stdin to stdout\n", "\n", " The filter:\n", "\n", " * reads a JSON-formatted pandoc document from stdin\n", " * transforms it by walking the tree and performing the actions\n", " * returns a new JSON-formatted ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.015873015873015872 ]
32
0.000496
def getCalculationDependencies(self, flat=False, deps=None): """ Recursively calculates all dependencies of this calculation. The return value is dictionary of dictionaries (of dictionaries...) {service_UID1: {service_UID2: {service_UID3: {}, ...
[ "def", "getCalculationDependencies", "(", "self", ",", "flat", "=", "False", ",", "deps", "=", "None", ")", ":", "if", "deps", "is", "None", ":", "deps", "=", "[", "]", "if", "flat", "is", "True", "else", "{", "}", "for", "service", "in", "self", "...
32.846154
0.002275
[ "def getCalculationDependencies(self, flat=False, deps=None):\n", " \"\"\" Recursively calculates all dependencies of this calculation.\n", " The return value is dictionary of dictionaries (of dictionaries...)\n", "\n", " {service_UID1:\n", " {service_UID2:\n", ...
[ 0, 0.0136986301369863, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05263157894736842 ]
26
0.002551
def _sub16(ins): ''' Pops last 2 words from the stack and subtract them. Then push the result onto the stack. Top of the stack is subtracted Top -1 Optimizations: * If 2nd op is ZERO, then do NOTHING: A - 0 = A * If any of the operands is < 4, then DEC is used * If a...
[ "def", "_sub16", "(", "ins", ")", ":", "op1", ",", "op2", "=", "tuple", "(", "ins", ".", "quad", "[", "2", ":", "4", "]", ")", "if", "is_int", "(", "op2", ")", ":", "op", "=", "int16", "(", "op2", ")", "output", "=", "_16bit_oper", "(", "op1"...
24.117647
0.000781
[ "def _sub16(ins):\n", " ''' Pops last 2 words from the stack and subtract them.\n", " Then push the result onto the stack. Top of the stack is\n", " subtracted Top -1\n", "\n", " Optimizations:\n", " * If 2nd op is ZERO,\n", " then do NOTHING: A - 0 = A\n", "\n", " * I...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.058823529411764705 ]
51
0.001153
def connectivity_map(dset,prefix,x,y,z,radius=2): '''Will perform connectivity analysis on ``dset`` using seed point ``(x,y,z)`` (in RAI order) with a sphere of radius ``radius``. Does not perform any preprocessing of ``dset``. This should be already motion corrected, noise-regressed, residualized, etc.''' ...
[ "def", "connectivity_map", "(", "dset", ",", "prefix", ",", "x", ",", "y", ",", "z", ",", "radius", "=", "2", ")", ":", "seed_series", "=", "nl", ".", "sphere_average", "(", "dset", ",", "x", ",", "y", ",", "z", ",", "radius", ")", "with", "tempf...
45.066667
0.02029
[ "def connectivity_map(dset,prefix,x,y,z,radius=2):\n", " '''Will perform connectivity analysis on ``dset`` using seed point ``(x,y,z)`` (in RAI order) with a sphere of radius ``radius``.\n", " Does not perform any preprocessing of ``dset``. This should be already motion corrected, noise-regressed, residua...
[ 0.1, 0.007462686567164179, 0.007575757575757576, 0.07272727272727272, 0, 0, 0, 0, 0.023809523809523808, 0, 0, 0, 0, 0.08333333333333333, 0.08333333333333333 ]
15
0.025216
def reset(self): """Resets the iterator to the beginning of the data.""" self.curr_idx = 0 random.shuffle(self.idx) for buck in self.data: np.random.shuffle(buck)
[ "def", "reset", "(", "self", ")", ":", "self", ".", "curr_idx", "=", "0", "random", ".", "shuffle", "(", "self", ".", "idx", ")", "for", "buck", "in", "self", ".", "data", ":", "np", ".", "random", ".", "shuffle", "(", "buck", ")" ]
33.5
0.009709
[ "def reset(self):\n", " \"\"\"Resets the iterator to the beginning of the data.\"\"\"\n", " self.curr_idx = 0\n", " random.shuffle(self.idx)\n", " for buck in self.data:\n", " np.random.shuffle(buck)" ]
[ 0, 0.015625, 0, 0, 0, 0.02857142857142857 ]
6
0.007366
def set_position(self, x, y, speed=None): ''' Move chuck to absolute position in um''' if speed: self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y %d' % (x, y, speed)) else: self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y' % (x, y))
[ "def", "set_position", "(", "self", ",", "x", ",", "y", ",", "speed", "=", "None", ")", ":", "if", "speed", ":", "self", ".", "_intf", ".", "write", "(", "'MoveChuckSubsite %1.1f %1.1f R Y %d'", "%", "(", "x", ",", "y", ",", "speed", ")", ")", "else"...
46.5
0.010563
[ "def set_position(self, x, y, speed=None):\n", " ''' Move chuck to absolute position in um'''\n", " if speed:\n", " self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y %d' % (x, y, speed))\n", " else:\n", " self._intf.write('MoveChuckSubsite %1.1f %1.1f R Y' % (x,...
[ 0, 0.018867924528301886, 0, 0.011904761904761904, 0, 0.0136986301369863 ]
6
0.007412