Dataset Viewer
Auto-converted to Parquet Duplicate
text
stringlengths
75
104k
code_tokens
sequence
avg_line_len
float64
7.91
980
score
float64
0
0.18
texts
sequence
scores
sequence
num_lines
int64
3
2.77k
avg_score
float64
0
0.37
def from_fortran_file(cls, fortran_file: str, tmpdir: str = "."): """Builds GrFN object from a Fortran program.""" stem = Path(fortran_file).stem if tmpdir == "." and "/" in fortran_file: tmpdir = Path(fortran_file).parent preprocessed_fortran_file = f"{tmpdir}/{stem}_preproc...
[ "def", "from_fortran_file", "(", "cls", ",", "fortran_file", ":", "str", ",", "tmpdir", ":", "str", "=", "\".\"", ")", ":", "stem", "=", "Path", "(", "fortran_file", ")", ".", "stem", "if", "tmpdir", "==", "\".\"", "and", "\"/\"", "in", "fortran_file", ...
38.055556
0.001423
[ "def from_fortran_file(cls, fortran_file: str, tmpdir: str = \".\"):\n", " \"\"\"Builds GrFN object from a Fortran program.\"\"\"\n", " stem = Path(fortran_file).stem\n", " if tmpdir == \".\" and \"/\" in fortran_file:\n", " tmpdir = Path(fortran_file).parent\n", " p...
[ 0, 0.017543859649122806, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 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 ]
36
0.002223
def get_serializer(context): """Returns a serializer for a given context""" cluster_config = context.get_cluster_config() serializer_clsname = cluster_config.get(constants.TOPOLOGY_SERIALIZER_CLASSNAME, None) if serializer_clsname is None: return PythonSerializer() else: try: top...
[ "def", "get_serializer", "(", "context", ")", ":", "cluster_config", "=", "context", ".", "get_cluster_config", "(", ")", "serializer_clsname", "=", "cluster_config", ".", "get", "(", "constants", ".", "TOPOLOGY_SERIALIZER_CLASSNAME", ",", "None", ")", "if", "seri...
46
0.009321
[ "def get_serializer(context):\n", " \"\"\"Returns a serializer for a given context\"\"\"\n", " cluster_config = context.get_cluster_config()\n", " serializer_clsname = cluster_config.get(constants.TOPOLOGY_SERIALIZER_CLASSNAME, None)\n", " if serializer_clsname is None:\n", " return Pytho...
[ 0, 0, 0, 0.01098901098901099, 0, 0.03125, 0, 0.09090909090909091, 0, 0, 0.010869565217391304, 0, 0, 0.034482758620689655, 0.01, 0.017241379310344827 ]
16
0.012859
def reset_parameter(**kwargs): """Create a callback that resets the parameter after the first iteration. Note ---- The initial parameter will still take in-effect on first iteration. Parameters ---------- **kwargs : value should be list or function List of parameters for each boost...
[ "def", "reset_parameter", "(", "*", "*", "kwargs", ")", ":", "def", "_callback", "(", "env", ")", ":", "new_parameters", "=", "{", "}", "for", "key", ",", "value", "in", "kwargs", ".", "items", "(", ")", ":", "if", "key", "in", "[", "'num_class'", ...
41.023256
0.001661
[ "def reset_parameter(**kwargs):\n", " \"\"\"Create a callback that resets the parameter after the first iteration.\n", "\n", " Note\n", " ----\n", " The initial parameter will still take in-effect on first iteration.\n", "\n", " Parameters\n", " ----------\n", " **kwargs : val...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011363636363636364, 0, 0, 0.010869565217391304, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05 ]
43
0.00168
def _filter(self, filename): """ return 'true' if filename doesn't match name_filter regex and should be filtered out of the list. @param filename: @return: """ return self.name_filter is not None and re.search(self.name_filter, filename) is None
[ "def", "_filter", "(", "self", ",", "filename", ")", ":", "return", "self", ".", "name_filter", "is", "not", "None", "and", "re", ".", "search", "(", "self", ".", "name_filter", ",", "filename", ")", "is", "None" ]
41.142857
0.013605
[ "def _filter(self, filename):\n", " \"\"\"\n", " return 'true' if filename doesn't match name_filter regex and should be filtered out of the list.\n", " @param filename:\n", " @return:\n", " \"\"\"\n", " return self.name_filter is not None and re.search(self.nam...
[ 0, 0.08333333333333333, 0.009433962264150943, 0, 0, 0, 0.021505376344086023 ]
7
0.016325
def load_source(source): """ Common entry point for loading some form of raw swagger schema. Supports: - python object (dictionary-like) - path to yaml file - path to json file - file object (json or yaml). - json string. - yaml string. """ if isinsta...
[ "def", "load_source", "(", "source", ")", ":", "if", "isinstance", "(", "source", ",", "collections", ".", "Mapping", ")", ":", "return", "deepcopy", "(", "source", ")", "elif", "hasattr", "(", "source", ",", "'read'", ")", "and", "callable", "(", "sourc...
30.978261
0.00068
[ "def load_source(source):\n", " \"\"\"\n", " Common entry point for loading some form of raw swagger schema.\n", "\n", " Supports:\n", " - python object (dictionary-like)\n", " - path to yaml file\n", " - path to json file\n", " - file object (json or yaml).\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.2 ]
46
0.004348
def metric(self, slug, num=1, category=None, expire=None, date=None): """Records a metric, creating it if it doesn't exist or incrementing it if it does. All metrics are prefixed with 'm', and automatically aggregate for Seconds, Minutes, Hours, Day, Week, Month, and Year. Parameters: ...
[ "def", "metric", "(", "self", ",", "slug", ",", "num", "=", "1", ",", "category", "=", "None", ",", "expire", "=", "None", ",", "date", "=", "None", ")", ":", "# Add the slug to the set of metric slugs", "self", ".", "r", ".", "sadd", "(", "self", ".",...
42.886364
0.001036
[ "def metric(self, slug, num=1, category=None, expire=None, date=None):\n", " \"\"\"Records a metric, creating it if it doesn't exist or incrementing it\n", " if it does. All metrics are prefixed with 'm', and automatically\n", " aggregate for Seconds, Minutes, Hours, Day, Week, Month, and...
[ 0, 0.0125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.045454545454545456 ]
44
0.001317
def weather_from_dictionary(d): """ Builds a *Weather* object out of a data dictionary. Only certain properties of the dictionary are used: if these properties are not found or cannot be read, an error is issued. :param d: a data dictionary :type d: dict :returns: a *Weather* instance :...
[ "def", "weather_from_dictionary", "(", "d", ")", ":", "# -- times", "if", "'dt'", "in", "d", ":", "reference_time", "=", "d", "[", "'dt'", "]", "elif", "'dt'", "in", "d", "[", "'last'", "]", ":", "reference_time", "=", "d", "[", "'last'", "]", "[", "...
31.874346
0.000796
[ "def weather_from_dictionary(d):\n", " \"\"\"\n", " Builds a *Weather* object out of a data dictionary. Only certain\n", " properties of the dictionary are used: if these properties are not\n", " found or cannot be read, an error is issued.\n", "\n", " :param d: a data dictionary\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...
191
0.000369
def run(self, agent_host): """run the agent on the world""" total_reward = 0 current_r = 0 tol = 0.01 self.prev_s = None self.prev_a = None # wait for a valid observation world_state = agent_host.peekWorldState() while world_stat...
[ "def", "run", "(", "self", ",", "agent_host", ")", ":", "total_reward", "=", "0", "current_r", "=", "0", "tol", "=", "0.01", "self", ".", "prev_s", "=", "None", "self", ".", "prev_a", "=", "None", "# wait for a valid observation", "world_state", "=", "agen...
47.090909
0.014337
[ "def run(self, agent_host):\n", " \"\"\"run the agent on the world\"\"\"\n", "\n", " total_reward = 0\n", " current_r = 0\n", " tol = 0.01\n", " \n", " self.prev_s = None\n", " self.prev_a = None\n", " \n", " # wait for a valid obser...
[ 0, 0.024390243902439025, 0, 0, 0, 0, 0.1111111111111111, 0, 0, 0.1111111111111111, 0, 0, 0.0196078431372549, 0, 0, 0, 0.008264462809917356, 0, 0, 0, 0, 0, 0, 0.022222222222222223, 0.07692307692307693, 0, 0.1111111111111111, 0.03225806451612903, 0, 0, 0.056...
132
0.017681
def autodiscover(module_name=None): """ Autodiscover INSTALLED_APPS perms.py modules and fail silently when not present. This forces an import on them to register any permissions bits they may want. """ from django.utils.module_loading import module_has_submodule from permission.compat impor...
[ "def", "autodiscover", "(", "module_name", "=", "None", ")", ":", "from", "django", ".", "utils", ".", "module_loading", "import", "module_has_submodule", "from", "permission", ".", "compat", "import", "import_module", "from", "permission", ".", "conf", "import", ...
41
0.001907
[ "def autodiscover(module_name=None):\n", " \"\"\"\n", " Autodiscover INSTALLED_APPS perms.py modules and fail silently when not\n", " present. This forces an import on them to register any permissions bits\n", " they may want.\n", " \"\"\"\n", " from django.utils.module_loading import ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.0625, 0, 0, 0, 0, 0.047619047619047616 ]
25
0.004405
def json2py(json_obj): """ Converts the inputted JSON object to a python value. :param json_obj | <variant> """ for key, value in json_obj.items(): if type(value) not in (str, unicode): continue # restore a datetime if re.match('^\d{4}-\d{2}-\d{2} \d{2}...
[ "def", "json2py", "(", "json_obj", ")", ":", "for", "key", ",", "value", "in", "json_obj", ".", "items", "(", ")", ":", "if", "type", "(", "value", ")", "not", "in", "(", "str", ",", "unicode", ")", ":", "continue", "# restore a datetime", "if", "re"...
33.424242
0.014097
[ "def json2py(json_obj):\n", " \"\"\"\n", " Converts the inputted JSON object to a python value.\n", " \n", " :param json_obj | <variant>\n", " \"\"\"\n", " for key, value in json_obj.items():\n", " if type(value) not in (str, unicode):\n", " continue\n", "\...
[ 0, 0, 0, 0.2, 0, 0, 0, 0, 0, 0, 0, 0.0958904109589041, 0, 0.05660377358490566, 0, 0, 0.07017543859649122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.05263157894736842 ]
33
0.014403
def join_multiline_pairs(source, pair="()"): """ Finds and removes newlines in multiline matching pairs of characters in *source*. By default it joins parens () but it will join any two characters given via the *pair* variable. .. note:: Doesn't remove extraneous whitespace that ends ...
[ "def", "join_multiline_pairs", "(", "source", ",", "pair", "=", "\"()\"", ")", ":", "opener", "=", "pair", "[", "0", "]", "closer", "=", "pair", "[", "1", "]", "io_obj", "=", "io", ".", "StringIO", "(", "source", ")", "out_tokens", "=", "[", "]", "...
28.613636
0.001536
[ "def join_multiline_pairs(source, pair=\"()\"):\n", " \"\"\"\n", " Finds and removes newlines in multiline matching pairs of characters in\n", " *source*.\n", "\n", " By default it joins parens () but it will join any two characters given via\n", " the *pair* variable.\n", "\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011494252873563218, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.022222222222222223 ]
44
0.000766
def do_watch(self, params): """ \x1b[1mNAME\x1b[0m watch - Recursively watch for all changes under a path. \x1b[1mSYNOPSIS\x1b[0m watch <start|stop|stats> <path> [options] \x1b[1mDESCRIPTION\x1b[0m watch start <path> [debug] [depth] with debug=true, print watches as they fire....
[ "def", "do_watch", "(", "self", ",", "params", ")", ":", "wm", "=", "get_watch_manager", "(", "self", ".", "_zk", ")", "if", "params", ".", "command", "==", "\"start\"", ":", "debug", "=", "to_bool", "(", "params", ".", "debug", ")", "children", "=", ...
31.254902
0.001217
[ "def do_watch(self, params):\n", " \"\"\"\n", "\\x1b[1mNAME\\x1b[0m\n", " watch - Recursively watch for all changes under a path.\n", "\n", "\\x1b[1mSYNOPSIS\\x1b[0m\n", " watch <start|stop|stats> <path> [options]\n", "\n", "\\x1b[1mDESCRIPTION\\x1b[0m\n", " watch start...
[ 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.0136986301369863 ]
51
0.001903
def from_archive(cls, archive: Archive, predictor_name: str = None) -> 'Predictor': """ Instantiate a :class:`Predictor` from an :class:`~allennlp.models.archival.Archive`; that is, from the result of training a model. Optionally specify which `Predictor` subclass; otherwise, the default...
[ "def", "from_archive", "(", "cls", ",", "archive", ":", "Archive", ",", "predictor_name", ":", "str", "=", "None", ")", "->", "'Predictor'", ":", "# Duplicate the config so that the config inside the archive doesn't get consumed", "config", "=", "archive", ".", "config"...
48.521739
0.008787
[ "def from_archive(cls, archive: Archive, predictor_name: str = None) -> 'Predictor':\n", " \"\"\"\n", " Instantiate a :class:`Predictor` from an :class:`~allennlp.models.archival.Archive`;\n", " that is, from the result of training a model. Optionally specify which `Predictor`\n", " ...
[ 0.011904761904761904, 0.08333333333333333, 0.010752688172043012, 0.01098901098901099, 0, 0, 0.011111111111111112, 0, 0, 0, 0, 0.018867924528301886, 0.020618556701030927, 0.011904761904761904, 0, 0, 0, 0, 0, 0, 0, 0, 0.014084507042253521 ]
23
0.008416
def block(context_name, parent_block_func, view_func=None): """A decorator that is used for inserting the decorated block function in the block template hierarchy. The :func:`block` decorator accepts the following arguments: :param context_name: key in the `g.blocks` dictionary in which the result ...
[ "def", "block", "(", "context_name", ",", "parent_block_func", ",", "view_func", "=", "None", ")", ":", "def", "decorator", "(", "block_func", ")", ":", "block", "=", "Block", "(", "block_func", ",", "view_func", ")", "parent_block", "=", "Block", ".", "bl...
53.307692
0.000709
[ "def block(context_name, parent_block_func, view_func=None):\n", " \"\"\"A decorator that is used for inserting the decorated block function in\n", " the block template hierarchy.\n", "\n", " The :func:`block` decorator accepts the following arguments:\n", "\n", " :param context_name: key in...
[ 0, 0, 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.001923
def keys(self): """Create an ordered dict of the names and values of key fields.""" keys = OrderedDict() def order_key(_): (k, v) = _ cache_key = getattr(type(self), k) return cache_key.order items = [(k, getattr(type(self), k)) for k in...
[ "def", "keys", "(", "self", ")", ":", "keys", "=", "OrderedDict", "(", ")", "def", "order_key", "(", "_", ")", ":", "(", "k", ",", "v", ")", "=", "_", "cache_key", "=", "getattr", "(", "type", "(", "self", ")", ",", "k", ")", "return", "cache_k...
25.52381
0.01259
[ "def keys(self):\n", " \"\"\"Create an ordered dict of the names and values of key fields.\"\"\"\n", "\n", " keys = OrderedDict()\n", "\n", " def order_key(_):\n", " (k, v) = _\n", " cache_key = getattr(type(self), k)\n", " return cache_key.order...
[ 0, 0.013157894736842105, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03225806451612903, 0.1, 0, 0.047619047619047616, 0.029411764705882353, 0.1, 0, 0, 0, 0.05263157894736842 ]
21
0.017861
def update(self, points, pointvol=0., vol_dec=0.5, vol_check=2., rstate=None, bootstrap=0, pool=None, mc_integrate=False): """ Update the set of ellipsoids to bound the collection of points. Parameters ---------- points : `~numpy.ndarray` with shape (npoints, ndim...
[ "def", "update", "(", "self", ",", "points", ",", "pointvol", "=", "0.", ",", "vol_dec", "=", "0.5", ",", "vol_check", "=", "2.", ",", "rstate", "=", "None", ",", "bootstrap", "=", "0", ",", "pool", "=", "None", ",", "mc_integrate", "=", "False", "...
39.07619
0.000713
[ "def update(self, points, pointvol=0., vol_dec=0.5, vol_check=2.,\n", " rstate=None, bootstrap=0, pool=None, mc_integrate=False):\n", " \"\"\"\n", " Update the set of ellipsoids to bound the collection of points.\n", "\n", " Parameters\n", " ----------\n", " ...
[ 0, 0.0136986301369863, 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...
105
0.001049
def get(self, name, return_json=False, quiet=False): '''get is a list for a single instance. It is assumed to be running, and we need to look up the PID, etc. ''' from spython.utils import check_install check_install() # Ensure compatible for singularity prior to 3.0, and after 3.0 subgr...
[ "def", "get", "(", "self", ",", "name", ",", "return_json", "=", "False", ",", "quiet", "=", "False", ")", ":", "from", "spython", ".", "utils", "import", "check_install", "check_install", "(", ")", "# Ensure compatible for singularity prior to 3.0, and after 3.0", ...
28.473684
0.002382
[ "def get(self, name, return_json=False, quiet=False):\n", " '''get is a list for a single instance. It is assumed to be running,\n", " and we need to look up the PID, etc.\n", " '''\n", " from spython.utils import check_install\n", " check_install()\n", "\n", " # Ensure compatible...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03508771929824561, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.1111111111111111, 0, 0, 0, 0, 0, 0, 0, 0, 0...
57
0.003442
def removed(name, updates=None): ''' Ensure Microsoft Updates are uninstalled. Args: name (str): The identifier of a single update to uninstall. updates (list): A list of identifiers for updates to be removed. Overrides ``name``. Default is None. ....
[ "def", "removed", "(", "name", ",", "updates", "=", "None", ")", ":", "if", "isinstance", "(", "updates", ",", "six", ".", "string_types", ")", ":", "updates", "=", "[", "updates", "]", "if", "not", "updates", ":", "updates", "=", "name", "ret", "=",...
28.52459
0.000833
[ "def removed(name, updates=None):\n", " '''\n", " Ensure Microsoft Updates are uninstalled.\n", "\n", " Args:\n", "\n", " name (str):\n", " The identifier of a single update to uninstall.\n", "\n", " updates (list):\n", " A list of identifiers for upd...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.012345679012345678, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.008130081300813009, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...
122
0.000753
def alter_edge(self, from_index, to_index, to_jimage=None, new_weight=None, new_edge_properties=None): """ Alters either the weight or the edge_properties of an edge in the StructureGraph. :param from_index: int :param to_index: int :param to_jimage: t...
[ "def", "alter_edge", "(", "self", ",", "from_index", ",", "to_index", ",", "to_jimage", "=", "None", ",", "new_weight", "=", "None", ",", "new_edge_properties", "=", "None", ")", ":", "existing_edges", "=", "self", ".", "graph", ".", "get_edge_data", "(", ...
40.5
0.002296
[ "def alter_edge(self, from_index, to_index, to_jimage=None,\n", " new_weight=None, new_edge_properties=None):\n", " \"\"\"\n", " Alters either the weight or the edge_properties of\n", " an edge in the StructureGraph.\n", "\n", " :param from_index: int\n", ...
[ 0, 0.015873015873015872, 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.02127659574468085 ]
42
0.002869
def render_registration(self): ''' Render pinned points on video frame as red rectangle. ''' surface = self.get_surface() if self.canvas is None or self.df_canvas_corners.shape[0] == 0: return surface corners = self.df_canvas_corners.copy() corners['w...
[ "def", "render_registration", "(", "self", ")", ":", "surface", "=", "self", ".", "get_surface", "(", ")", "if", "self", ".", "canvas", "is", "None", "or", "self", ".", "df_canvas_corners", ".", "shape", "[", "0", "]", "==", "0", ":", "return", "surfac...
34.24
0.002273
[ "def render_registration(self):\n", " '''\n", " Render pinned points on video frame as red rectangle.\n", " '''\n", " surface = self.get_surface()\n", " if self.canvas is None or self.df_canvas_corners.shape[0] == 0:\n", " return surface\n", "\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.045454545454545456 ]
25
0.005152
def completed_number(prefix, length): """ 'prefix' is the start of the CC number as a string, any number of digits. 'length' is the length of the CC number to generate. Typically 13 or 16 """ ccnumber = prefix # generate digits while len(ccnumber) < (length - 1): digit = random.choic...
[ "def", "completed_number", "(", "prefix", ",", "length", ")", ":", "ccnumber", "=", "prefix", "# generate digits", "while", "len", "(", "ccnumber", ")", "<", "(", "length", "-", "1", ")", ":", "digit", "=", "random", ".", "choice", "(", "[", "'0'", ","...
32.25
0.009677
[ "def completed_number(prefix, length):\n", " \"\"\"\n", " 'prefix' is the start of the CC number as a string, any number of digits.\n", " 'length' is the length of the CC number to generate. Typically 13 or 16\n", " \"\"\"\n", " ccnumber = prefix\n", " # generate digits\n", " whil...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0.012048192771084338, 0, 0.047619047619047616, 0, 0, 0, 0, 0, 0, 0.0425531914893617, 0, 0, 0, 0, 0.04, 0, 0, 0, 0.045454545454545456, 0.03571428571428571 ]
28
0.007978
def get_field_info(wrapper,entity_type): 'type: wrapper :atws.Wrapper' fields = wrapper.new('GetFieldInfo') fields.psObjectType = entity_type return wrapper.GetFieldInfo(fields)
[ "def", "get_field_info", "(", "wrapper", ",", "entity_type", ")", ":", "fields", "=", "wrapper", ".", "new", "(", "'GetFieldInfo'", ")", "fields", ".", "psObjectType", "=", "entity_type", "return", "wrapper", ".", "GetFieldInfo", "(", "fields", ")" ]
37.8
0.010363
[ "def get_field_info(wrapper,entity_type):\n", " 'type: wrapper :atws.Wrapper'\n", " fields = wrapper.new('GetFieldInfo')\n", " fields.psObjectType = entity_type\n", " return wrapper.GetFieldInfo(fields)" ]
[ 0.024390243902439025, 0, 0, 0, 0.02564102564102564 ]
5
0.010006
def graph_from_seeds(seeds, cell_source): """ This creates/updates a networkx graph from a list of cells. The graph is created when the cell_source is an instance of ExcelCompiler The graph is updated when the cell_source is an instance of Spreadsheet """ # when called from Spreadsheet instanc...
[ "def", "graph_from_seeds", "(", "seeds", ",", "cell_source", ")", ":", "# when called from Spreadsheet instance, use the Spreadsheet cellmap and graph", "if", "hasattr", "(", "cell_source", ",", "'G'", ")", ":", "# ~ cell_source is a Spreadsheet", "cellmap", "=", "cell_source...
43.918552
0.008966
[ "def graph_from_seeds(seeds, cell_source):\n", " \"\"\"\n", " This creates/updates a networkx graph from a list of cells.\n", "\n", " The graph is created when the cell_source is an instance of ExcelCompiler\n", " The graph is updated when the cell_source is an instance of Spreadsheet\n", " ...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0.012048192771084338, 0.014925373134328358, 0, 0, 0, 0, 0, 0, 0.011627906976744186, 0.022222222222222223, 0.017543859649122806, 0, 0, 0, 0, 0.02040816326530612, 0, 0, 0, 0.023255813953488372, 0, 0, 0, 0, 0, 0, 0, 0.0138888...
221
0.004621
def port(alias_name, default=None, allow_none=False): """Get the port from the docker link alias or return the default. Args: alias_name: The docker link alias default: The default value if the link isn't available allow_none: If the return value can be `None` (i.e. optional) Examp...
[ "def", "port", "(", "alias_name", ",", "default", "=", "None", ",", "allow_none", "=", "False", ")", ":", "warnings", ".", "warn", "(", "'Will be removed in v1.0'", ",", "DeprecationWarning", ",", "stacklevel", "=", "2", ")", "try", ":", "return", "int", "...
34.478261
0.002454
[ "def port(alias_name, default=None, allow_none=False):\n", " \"\"\"Get the port from the docker link alias or return the default.\n", "\n", " Args:\n", " alias_name: The docker link alias\n", " default: The default value if the link isn't available\n", " allow_none: If the ret...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.011627906976744186, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.047619047619047616 ]
23
0.002576
def value_to_db(self, value): """ Returns field's single value prepared for saving into a database. """ assert isinstance(value, six.integer_types) return str(value).encode("utf_8")
[ "def", "value_to_db", "(", "self", ",", "value", ")", ":", "assert", "isinstance", "(", "value", ",", "six", ".", "integer_types", ")", "return", "str", "(", "value", ")", ".", "encode", "(", "\"utf_8\"", ")" ]
50.5
0.014634
[ "def value_to_db(self, value):\n", " \"\"\" Returns field's single value prepared for saving into a database. \"\"\"\n", " assert isinstance(value, six.integer_types)\n", " return str(value).encode(\"utf_8\")" ]
[ 0, 0.024390243902439025, 0, 0.024390243902439025 ]
4
0.012195
def get(self, sid): """ Constructs a OriginationUrlContext :param sid: The unique string that identifies the resource :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext :rtype: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext ...
[ "def", "get", "(", "self", ",", "sid", ")", ":", "return", "OriginationUrlContext", "(", "self", ".", "_version", ",", "trunk_sid", "=", "self", ".", "_solution", "[", "'trunk_sid'", "]", ",", "sid", "=", "sid", ",", ")" ]
41.8
0.01171
[ "def get(self, sid):\n", " \"\"\"\n", " Constructs a OriginationUrlContext\n", "\n", " :param sid: The unique string that identifies the resource\n", "\n", " :returns: twilio.rest.trunking.v1.trunk.origination_url.OriginationUrlContext\n", " :rtype: twilio.rest.trunk...
[ 0, 0.08333333333333333, 0, 0, 0, 0, 0.011627906976744186, 0.011904761904761904, 0, 0.019801980198019802 ]
10
0.012667
def from_header(self, header): """Generate a SpanContext object using the trace context header. The value of enabled parsed from header is int. Need to convert to bool. :type header: str :param header: Trace context header which was extracted from the HTTP ...
[ "def", "from_header", "(", "self", ",", "header", ")", ":", "if", "header", "is", "None", ":", "return", "SpanContext", "(", ")", "try", ":", "match", "=", "re", ".", "search", "(", "_TRACE_CONTEXT_HEADER_RE", ",", "header", ")", "except", "TypeError", "...
33.690476
0.001374
[ "def from_header(self, header):\n", " \"\"\"Generate a SpanContext object using the trace context header.\n", " The value of enabled parsed from header is int. Need to convert to\n", " bool.\n", "\n", " :type header: str\n", " :param header: Trace context header which ...
[ 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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.03125 ]
42
0.00107
def apply_multicolor_transit(self,band,depth): """ Applies constraint corresponding to measuring transit in different band This is not implemented yet. """ if '{} band transit'.format(band) not in self.constraints: self.constraints.append('{} band transit'.format(ban...
[ "def", "apply_multicolor_transit", "(", "self", ",", "band", ",", "depth", ")", ":", "if", "'{} band transit'", ".", "format", "(", "band", ")", "not", "in", "self", ".", "constraints", ":", "self", ".", "constraints", ".", "append", "(", "'{} band transit'"...
40
0.012225
[ "def apply_multicolor_transit(self,band,depth):\n", " \"\"\"\n", " Applies constraint corresponding to measuring transit in different band\n", "\n", " This is not implemented yet.\n", " \"\"\"\n", " if '{} band transit'.format(band) not in self.constraints:\n", " ...
[ 0.0425531914893617, 0.08333333333333333, 0, 0, 0, 0, 0, 0, 0, 0.038461538461538464 ]
10
0.016435
def add_view( self, baseview, name, href="", icon="", label="", category="", category_icon="", category_label="", ): """ Add your views associated with menus using this method. :param baseview: A BaseView ty...
[ "def", "add_view", "(", "self", ",", "baseview", ",", "name", ",", "href", "=", "\"\"", ",", "icon", "=", "\"\"", ",", "label", "=", "\"\"", ",", "category", "=", "\"\"", ",", "category_icon", "=", "\"\"", ",", "category_label", "=", "\"\"", ",", ")"...
34.858824
0.001969
[ "def add_view(\n", " self,\n", " baseview,\n", " name,\n", " href=\"\",\n", " icon=\"\",\n", " label=\"\",\n", " category=\"\",\n", " category_icon=\"\",\n", " category_label=\"\",\n", " ):\n", " \"\"\"\n", " Add...
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.14285714285714285, 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.011627906976744186, 0, 0, 0, 0, 0, 0, 0, 0...
85
0.00358
def do_some_work( self, work_dict): """do_some_work :param work_dict: dictionary for key/values """ label = "do_some_work" log.info(("task - {} - start " "work_dict={}") .format(label, work_dict)) ret_data = { "job_resul...
[ "def", "do_some_work", "(", "self", ",", "work_dict", ")", ":", "label", "=", "\"do_some_work\"", "log", ".", "info", "(", "(", "\"task - {} - start \"", "\"work_dict={}\"", ")", ".", "format", "(", "label", ",", "work_dict", ")", ")", "ret_data", "=", "{", ...
20.192308
0.001818
[ "def do_some_work(\n", " self,\n", " work_dict):\n", " \"\"\"do_some_work\n", "\n", " :param work_dict: dictionary for key/values\n", " \"\"\"\n", "\n", " label = \"do_some_work\"\n", "\n", " log.info((\"task - {} - start \"\n", " \"work_dict={}\")\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.05263157894736842 ]
26
0.002024
def active_vectors_info(self): """Return the active scalar's field and name: [field, name]""" if not hasattr(self, '_active_vectors_info'): self._active_vectors_info = [POINT_DATA_FIELD, None] # field and name _, name = self._active_vectors_info # rare error where scalar nam...
[ "def", "active_vectors_info", "(", "self", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'_active_vectors_info'", ")", ":", "self", ".", "_active_vectors_info", "=", "[", "POINT_DATA_FIELD", ",", "None", "]", "# field and name", "_", ",", "name", "=", ...
40.666667
0.008016
[ "def active_vectors_info(self):\n", " \"\"\"Return the active scalar's field and name: [field, name]\"\"\"\n", " if not hasattr(self, '_active_vectors_info'):\n", " self._active_vectors_info = [POINT_DATA_FIELD, None] # field and name\n", " _, name = self._active_vectors_info...
[ 0, 0.014084507042253521, 0, 0.024390243902439025, 0, 0, 0, 0, 0, 0, 0, 0.025 ]
12
0.00529
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
13